nginx多个静态路由不起作用

时间:2017-08-11 07:19:48

标签: nginx ubuntu-16.04

我有这个nginx配置:

server {

    listen 80 default_server;
    index index.html index.htm;
    server_name myserver;

    location / {
        root /var/www/html/;
        index  index.html;
    }

    location /doc/ {
        root /var/www/html2/;
        index  index.html;
    }

    location /api/ {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

我不明白为什么/doc/路线不起作用,它会返回404 Not Found? /api//路由可以正常运行。

我已经搜索过了https://serverfault.com/questions/684523/nginx-multiple-roots

由于

0 个答案:

没有答案
相关问题