前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【腾讯云的1001种玩法】使用腾讯云自建一个专属于自己的网络笔记本

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

原创
作者头像
慕星星
修改2017-06-19 19:09:29
2.7K0
修改2017-06-19 19:09:29
举报
文章被收录于专栏:慕星星的专栏慕星星的专栏

1、说明:

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

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

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

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

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

配置环境:CentOS7 64

2、安装:mongodb数据

代码语言:txt
复制
####安装mongodb部分
yum -y install wget  vim   #可以从网络获取资源
cd /home
wget  https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz
mv mongodb-linux-x86_64-3.0.1.tgz mongodb
tar -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
#重新开一个窗口
mongo
show dbs
#如果是有数据表列出,说明安装成功

3、安装:leanote程序

最新的leanote程序可以从这里下载:http://leanote.org/#download

选择:linux 64,具体还是根据自己的服务器来决定的

代码语言:txt
复制
####安装并设置leanote

cd /home
wget https://iweb.dl.sourceforge.net/project/leanote-bin/2.4/leanote-linux-amd64-v2.4.bin.tar.gz
tar -zxvf  leanote-linux-amd64-v2.4.bin.tar.gz
vim /home/leanote/conf/app.conf
#必须改变这里:app.secret





####导入leanote初始数据库
mongorestore -h localhost -d leanote --dir /home/leanote/mongodb_backup/leanote_install_data/


####启动leanote
cd /home/leanote/bin
sh run.sh
#现在再开一个窗口,从第三个窗口访问

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

代码语言:txt
复制
yum -y install nginx
#设置nginx开机自启动和启动nginx
systemctl enable nginx.service
systemctl 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自启动

代码语言:txt
复制
yum install -y epel-release
yum install -y python-setuptools m2crypto 
easy_install supervisor
echo_supervisord_conf > /etc/supervisord.conf


#编辑配置文件,末尾加入
vim /etc/supervisord.conf

[program:mongodb]
command=/home/mongodb/bin/mongod  --bind_ip 127.0.0.1   --dbpath=/home/mongoData
autostart=true
autorestart=true
user=root
log_stderr=true
logfile=/var/log/mongodb.log



[program:leanote]
command=/bin/bash /home/leanote/bin/run.sh
autostart=true
autorestart=true
user=root
log_stderr=true
logfile=/var/log/leanote.log

#保存后,关闭第一个、第二个窗口,在关闭前使用ctrl+c,然后启动supervisord服务
systemctl start superviord.service
echo 'systemctl start superviord.service' >>  /etc/rc.local

6、配置防火墙

代码语言:txt
复制
systemctl enable firewalld.service
systemctl start firewalld.service
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
##此时防火墙生效

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、说明:
  • 2、安装:mongodb数据
  • 3、安装:leanote程序
  • 4、安装:nginx,启用:https,从腾讯云SSL申请证书
  • 5、自启动处理:使用supervisord服务
  • 6、配置防火墙
相关产品与服务
云数据库 MongoDB
腾讯云数据库 MongoDB(TencentDB for MongoDB)是腾讯云基于全球广受欢迎的 MongoDB 打造的高性能 NoSQL 数据库,100%完全兼容 MongoDB 协议,支持跨文档事务,提供稳定丰富的监控管理,弹性可扩展、自动容灾,适用于文档型数据库场景,您无需自建灾备体系及控制管理系统。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档