相关疑难解决方法(0)

nginx proxy_pass 404错误,不明白为什么

我试图将所有对/ api的调用传递给我的webservice,但我继续使用以下配置获得404s.按预期调用/返回index.html.有谁知道为什么?

upstream backend{
    server localhost:8080;
}

 server {

    location /api {
        proxy_pass http://backend;
    }

    location / {
        root /html/dir;
    }
}
Run Code Online (Sandbox Code Playgroud)

更多信息在这里

adept@HogWarts:/etc/nginx/sites-available$ curl -i localhost/api/authentication/check/user/email
HTTP/1.1 404 Not Found
Server: nginx/1.2.1
Date: Mon, 22 Apr 2013 22:49:03 GMT
Content-Length: 0
Connection: keep-alive

adept@HogWarts:/etc/nginx/sites-available$ curl -i localhost:8080/authentication/check/user/email
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 22 Apr 2013 22:49:20 GMT
Transfer-Encoding: chunked

{"user":["false"],"emailAddress":["false"]}
Run Code Online (Sandbox Code Playgroud)

nginx

32
推荐指数
4
解决办法
5万
查看次数

标签 统计

nginx ×1