很多情况下,对于一个程序员,作家、等等行业,都需要一个笔记本来记录自己的经验,创作等等。这么说来一个好的笔记本就需要好好选择和考虑的了。
今天我推荐一款笔记本,是网络笔记,名字是:蚂蚁笔记,leanote:开源产品。
需要一个域名,可以从腾讯、阿里申请。
需要一台服务器,建议从腾讯云购买,很便宜的,最低只需要45/月。
这是我的博客,正在备案,可能打不开。http://www.itgrub.com
配置环境:CentOS7 64
####安装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
#如果是有数据表列出,说明安装成功
最新的leanote程序可以从这里下载:http://leanote.org/#download
选择:linux 64,具体还是根据自己的服务器来决定的
####安装并设置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
#现在再开一个窗口,从第三个窗口访问
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的哦!
使用supervisord服务来控制leanote与mongodb自启动
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
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 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有