forever让nodejs应用后台执行:forever start -a bin/www
https://www.cnblogs.com/dreamfine/p/6891988.html
vue把axios请求改为相对路径(即去掉http://localhost:端口)
express在app.js里把代理插件关掉:
```
//var proxy = require('http-proxy-middleware');
//app.use('/api',proxy({
// target:'http://localhost:8080',
// changeOrigin:true
//}));
```
把package.json里的script改为:
```
"scripts": {
"start": "node ./bin/www"
}
```
阿里云控制台有端口防火墙,需要设置端口开启策略
(1) Nginx配置路径:/etc/nginx/ conf.d/新建47.96.239.32.conf,配置内容为:
```
upstream 47.96.239.32 {
server localhost:3000;
}
server {
listen 80;
server_name 47.96.239.32;
root /www/express;
error_log /data/log/nginx/47.96.239.32-error.log;
access_log /data/log/nginx/47.96.239.32-access.log;
#location /dist {
# alias /www/dist;
#}
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
(2) PID目录:/var/run/nginx.pid
(3) 错误日志:/var/log/nginx/error.log
(4) 访问日志:/var/log/nginx/access.log
(5) 默认站点目录:/usr/share/nginx/html
mongodb安装可以配置官网redhat的yum repo;安装后sudo service mongod start(stop)(restart)
mongorestore -h 127.0.0.1 -d lhs --dir /data/lhs 导入json数据库备份
netstat -lntp查看各种服务有没有开启,端口有没有正确
ps -ef | grep node 查看所有node进程
pwd当前路径
rm -rf强制删除(慎用)
telnet 47.96.239.32 80 测试本地能不能远程连接ip为47.96.239.32的80端口