mac nginx 配置及反向代理部署nodejs
nginx安装命令
- 安装Homebrew:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- 安装nginx:brew install nginx
- 启动:nginx
nginx 停止,重启等命令
-
nginx -s reload :修改配置后重新加载生效
- nginx -s reopen :重新打开日志文件
- nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确
- nginx -s stop :快速停止nginx
quit :完整有序的停止nginx - kill -QUIT 主进程号 :从容停止Nginx
kill -TERM 主进程号 :快速停止Nginx
pkill -9 nginx :强制停止Nginx - 启动nginx:
nginx -c /path/to/nginx.conf
平滑重启nginx:
kill -HUP 主进程号
反向代理部署nodejs
https://blog.csdn.net/jiestyle21/article/details/51393080
upstream nodejs { server 127.0.0.1:8888; #server 127.0.0.1:8888; keepalive 64; } server { listen 80; server_name money.ivan.com; access_log /home/wwwlogs/money.ivan.com.log access; location / { 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 Connection ""; proxy_pass http://nodejs; } }