server { listen 80; server_name www.a.com; access_log logs/test.access.log; # 匹配以/apis/開頭的請求 location ^~ /apis/ { proxy_pass http://www.b.com/; #注意域名後有一個/ } location / { root html/a; index index.html index.htm; } # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }複製代碼