Nginx 代理传递时没有出现此文件或目录错误

Nginx 代理传递时没有出现此文件或目录错误

我已经配置了 nginx,将 nodejs 服务器(8081)端口传递给外部 urlhttps://example.com/myapp

MyApp = nodejs 服务器 api 并且运行良好

我有另一个管理控制界面,完整的网址是https://example.com/myapp/admin

当我尝试登录管理界面时出现错误。使用 http url 可以正常工作。

错误日志:

  2016/03/08 11:20:28 [error] 25762#0: *16 open() "/usr/share/nginx/html/example.com/apis/users/admin/login/email" failed (2: No such file or directory), client: 202.164.23.112, server: example.com, request: "POST /apis/users/admin/login/email HTTP/1.1", host: "example.com", referrer: "https://example.com/myapp/admin"

其中 apis/users/admin/login/email 都是页面,而不是目录。

Nginx 服务器配置: /etc/nginx/sites-enabled/default

server {
    listen 80 default_server;
    server_name localhost;
    listen 443;
    root /usr/share/nginx/html;
    index index.html index.htm;
   ssl on;
    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;

location /myapp/ {
    proxy_pass https://0.0.0.0:8081;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    rewrite ^/myapp/(.*) /$1 break;

}

请提供建议并提前致谢:

相关内容