【发布时间】:2017-07-05 08:34:00
【问题描述】:
我正在运行 nginx 作为乘客独立 Rails 服务器的反向代理。
我需要在乘客独立端口 (5000) 上设置 root / 位置,但很少有其他子目录必须由“纯”nginx 提供服务。
我正在尝试类似的配置
server {
listen 443;
root /path/to/rails/public;
server_name example.com;
ssl on;
# ... some ssl config
# this is used for passenger standalone on port 5000
location / {
proxy_pass https://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
}
# this is not passenger standalone!
location /subdir {
proxy_pass https://127.0.0.1;
auth_basic "Restricted access area authorization needed.";
auth_basic_user_file /path/to/.htpasswd;
}
}
但https://example.com/subdir/ 总是返回 404 错误。 有什么解决办法吗?
【问题讨论】:
标签: ruby-on-rails nginx passenger proxypass