在Debian 8系统里安装cmswing网站程序
环境:Debian 8 64位,cmswing 1.1
过程:
- curl -sL https://deb.nodesource.com/setup_8.x | bash - 添加node v8安装源
- apt-get install -y nodejs git mariadb-server nginx 安装node v8 及其它软件
- npm install -g pm2 --registry=https://registry.npm.taobao.org --verbose 安装pm2
- git clone https://github.com/arterli/CmsWing.git 切换到普通用户,下载CmsWing程序文件
- cd CmsWing 切换到CmsWing目录
- 连接到mariadb,创建好cmswing数据库,往数据库导入cmswing.sql文件
- npm install --registry=https://registry.npm.taobao.org --verbose 安装相关的node模块
- 编辑 pm2.json 文件,将路径值修改为实际的,如本例是 /home/liujia/CmsWing
- pm2 start pm2.json 启动程序,默认会在 tcp 8360 监听
vi /etc/nginx/sites-enabled/mp.anqun.org.conf 创建一个新的nginx虚拟站点配置文件(配置了https),内容如下:
server {
listen 443 ssl;
server_name mp.anqun.org;
root /home/liujia/CmsWing/www;
set $node_port 8360;ssl_certificate /etc/nginx/ssl/1_mp.anqun.org_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/2_mp.anqun.org.key;ssl on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 2d;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;index index.js index.html index.htm;
if ( -f $request_filename/index.html ){rewrite (.*) $1/index.html break;
}
if ( !-f $request_filename ){rewrite (.*) /index.js;
}
location = /index.js {proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://127.0.0.1:$node_port$request_uri; proxy_redirect off;
}
location ~ /static/ {
etag on; expires max;
}
}- 重启nginx后在浏览器里访问测试,站点前台和后台显示正常
参考: