cd /etc/nginx/vim default.conf
示例配置:
第 12 ~ 14 行是反向代理的实现。前端访问路径中带有 /amt/prod/amt时会命中此条规则,通过 proxy_pass属性将请求转发至真正的接口服务器。
server {listen 1995;server_name localhost;#access_log /var/log/nginx/host.access.log main;location / {root /home/nginx_servers/1995;index index.html index.htm;}location ^~ /amt-prod/amt/ {proxy_pass http://123.57.1.19:9080;}error_page 500 502 503 504 /50x.html;location = /50x.html {root /usr/share/nginx/html;}}
