server { listen 80; server_name outsourcing.fai365.com; location / { root /data/outsourcing/; try_files $uri $uri/ /index.html last; autoindex on; index index.html index.htm; error_page 405 =200 http://$host$request_uri; } location ^~/api-outsourcing/ { lua_code_cache off; set $proxy_outsourcing_server ''; access_by_lua ' local aps = require "resty.outsourcing" outsourcing.proxy("/aps/apsServer/node/outsourcing/") '; proxy_pass $proxy_outsourcing_server; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; } location ^~/api/ { proxy_pass http://aps_user_server; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; } error_page 404 /index.html; }