Nginx代理多个80端口项目

find / -name "nginx.conf"

查找nginx位置

kill掉现有进程

ps -ef|grep nginx

做配置

server{
        listen       80;
        server_name  www.as-microwave.com;
        location / {
              alias  /var/local/webapp/aishangzhihui/aishangzhihui/; #默认访问vue静态文件目录>(dist路径)
              index  index.html; #默认访问文件
              try_files $uri $uri/ /index.html; #目录不存在则执行index.html
          }
         error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
   server {
      listen       80;
      server_name  www.jinxiuhangcheng.com;

   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_redirect off;
      proxy_pass http://127.0.0.1:8082;
     }
     access_log logs/data_access.log;
   }

 

重启

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

 

posted @ 2020-11-30 19:08  ZzUuOo666  阅读(177)  评论(0编辑  收藏  举报