【腾讯云的1001种玩法】使用腾讯云自建一个专属于自己的网络笔记本

来源:互联网 发布:淘宝开学季活动时间 编辑:程序博客网 时间:2024/05/11 01:41

腾讯云技术社区-博客主页持续为大家呈现云计算技术文章,欢迎大家关注!


作者:慕星星

1、说明:

很多情况下,对于一个程序员,作家、等等行业,都需要一个笔记本来记录自己的经验,创作等等。这么说来一个好的笔记本就需要好好选择和考虑的了。

今天我推荐一款笔记本,是网络笔记,名字是:蚂蚁笔记,leanote:开源产品。

需要一个域名,可以从腾讯、阿里申请。

需要一台服务器,建议从腾讯云购买,很便宜的,最低只需要45/月。

这是我的博客,正在备案,可能打不开。http://www.itgrub.com

配置环境:CentOS7 64

2、安装:mongodb数据

####安装mongodb部分yum -y install wget  vim   #可以从网络获取资源cd /homewget  https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgzmv mongodb-linux-x86_64-3.0.1.tgz mongodbtar -xzvf mongodb-linux-x86_64-3.0.1.tgz/mkdir mongoData #用于存储数据####设置mongodb部分vim /etc/profile#插入一行export PATH=$PATH:/home/user1/mongodb-linux-x86_64-3.0.1/bin#使之生效source /etc/profile####测试mongodb能否正常运行mongodb --dbpath /home/mongoData#重新开一个窗口mongoshow dbs#如果是有数据表列出,说明安装成功

3、安装:leanote程序

最新的leanote程序可以从这里下载:http://leanote.org/#download
选择:linux 64,具体还是根据自己的服务器来决定的

####安装并设置leanotecd /homewget https://iweb.dl.sourceforge.net/project/leanote-bin/2.4/leanote-linux-amd64-v2.4.bin.tar.gztar -zxvf  leanote-linux-amd64-v2.4.bin.tar.gzvim /home/leanote/conf/app.conf#必须改变这里:app.secret####导入leanote初始数据库mongorestore -h localhost -d leanote --dir /home/leanote/mongodb_backup/leanote_install_data/####启动leanotecd /home/leanote/binsh run.sh#现在再开一个窗口,从第三个窗口访问

4、安装:nginx,启用:https,从腾讯云SSL申请证书

yum -y install nginx#设置nginx开机自启动和启动nginxsystemctl enable nginx.servicesystemctl start nginx.service#把申请下来的证书放在/home/SSL中#在nginx中创建一个配置文档,启用自己的域名并准备访问cd /etc/nginx/conf.d/vim leanote.conf#输入以下文本# http    server    {        listen  80;        server_name  note.test.com;        rewrite ^/(.*) https://note.itgrub.com/$1 permanent;        proxy_set_header X-Forwarded-For $remote_addr;        location / {            proxy_pass        http://127.0.0.1:9000;            proxy_set_header   Host             $host;            proxy_set_header   X-Real-IP        $remote_addr;            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;        }    error_page 400 403 404 497 https://$host$uri$args;    }    # https    server    {        listen  443 ssl;        server_name  note.test.com;    ssl on;         ssl_certificate     /home/SSL/note.test.com.crt;         ssl_certificate_key /home/SSL/note.test.com.key;    proxy_set_header X-Forwarded-For $remote_addr;    location / {            proxy_pass        http://127.0.0.1:9000;            proxy_set_header   Host             $host;            proxy_set_header   X-Real-IP        $remote_addr;            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;        }    }#输入完成后保存systemctl nginx restart#现在就可以看下自己的网页了,而且还是支持https的哦!

5、自启动处理:使用supervisord服务

使用supervisord服务来控制leanote与mongodb自启动

yum install -y epel-releaseyum install -y python-setuptools m2crypto easy_install supervisorecho_supervisord_conf > /etc/supervisord.conf#编辑配置文件,末尾加入vim /etc/supervisord.conf[program:mongodb]command=/home/mongodb/bin/mongod  --bind_ip 127.0.0.1   --dbpath=/home/mongoDataautostart=trueautorestart=trueuser=rootlog_stderr=truelogfile=/var/log/mongodb.log[program:leanote]command=/bin/bash /home/leanote/bin/run.shautostart=trueautorestart=trueuser=rootlog_stderr=truelogfile=/var/log/leanote.log#保存后,关闭第一个、第二个窗口,在关闭前使用ctrl+c,然后启动supervisord服务systemctl start superviord.serviceecho 'systemctl start superviord.service' >>  /etc/rc.local

6、配置防火墙

systemctl enable firewalld.servicesystemctl start firewalld.servicefirewall-cmd --permanent --add-service=httpfirewall-cmd --permanent --add-service=httpsfirewall-cmd --reload##此时防火墙生效

相关推荐

如何购买腾讯云服务器
【腾讯云的1001种玩法】如何使用腾讯云服务器作为微信公众号的开发空间


此文已由作者授权腾讯云技术社区发布,转载请注明文章出处
原文链接:https://www.qcloud.com/community/article/11431001491442349
获取更多腾讯海量技术实践干货,欢迎大家前往腾讯云技术社区

1 0
原创粉丝点击