0
我有這個nginx的配置: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未找到? /api/
和/
路徑工作正常。
我已經搜查,發現該https://serverfault.com/questions/684523/nginx-multiple-roots
感謝
什麼是您嘗試訪問的文件的完整路徑以及您用來訪問該文件的URL是什麼? –
目前我只使用服務器的ip作爲url和它的一個簡單的index.html文件進行測試 – miholzi
你是指'http:// xxxx/doc /'的URL來訪問'/ var/www上的文件/ HTML2/index.html'? –