0
我試圖訪問運行在pm2
上的Sails
應用程序。如果我直接從運行它的服務器的IP訪問應用程序,則應用程序運行。Nginx上的反向代理服務器從一臺服務器到另一臺
當我在另一臺服務器上運行的Nginx作爲反向代理,下面的情況:
當我使用上origin.myserver.com
下面的配置,它仍然有效:
server {
listen 80;
location/{
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_connect_timeout 30s;
proxy_set_header Host $host;
proxy_pass http://dest.myserver:1337;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
然而,當我嘗試添加從Nginx的多個子目錄,這是行不通的:
server {
listen 80;
location /auth {
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_connect_timeout 30s;
proxy_set_header Host $host;
proxy_pass http://dest.myserver:1337;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
我收到的錯誤是:
2017/08/11 15:55:13 [error] 8304#0: *3 open() "/usr/share/nginx/html/locales/locale.js" failed (2: No such file or directory), client: IP, server: , request: "GET /locales/locale.js?v=1502466823352 HTTP/1.1", host: "REVERSE PROXY IP"