mac nginx 配置及反向代理部署nodejs

 nginx安装命令

  1. 安装Homebrew:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
  2. 安装nginx:brew install nginx  
  3. 启动:nginx

 nginx 停止,重启等命令

  1. nginx -s reload  :修改配置后重新加载生效
  2. nginx -s reopen  :重新打开日志文件
  3. nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确
  4. nginx -s stop  :快速停止nginx
             quit  :完整有序的停止nginx
  5. kill -QUIT 主进程号     :从容停止Nginx
    kill -TERM 主进程号     :快速停止Nginx
    pkill -9 nginx          :强制停止Nginx
  6. 启动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;

    }

}

 

 
 
posted @ 2018-09-14 11:22  tager.wang  阅读(156)  评论(0编辑  收藏  举报