我试图proxy_pass到一个Apache2实例使用命名的位置,但Nginx试图find磁盘上的指定位置?
Nginxconfiguration:
root /var/www; location / { try_files $uri @apache =404; } location @apache { proxy_intercept_errors on; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080; }
试图访问一个不存在的文件应该是proxy_pass,但是404会失败,日志显示:
trying to use file: "@apache" "/var/www@apache"
这是一个命名的位置,为什么它试图将其作为文件path来读取?
指定的位置需要在try_files最后出现。 你不应该有任何东西过去(事实上,它永远不会到达)。
try_files $uri @apache;