Nginx代理多個80埠專案
阿新 • • 發佈:2020-11-30
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