Reputation: 994
i have this nginx config:
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;
}
}
and I don't understand why the /doc/
route not works, it returns 404 Not Found? The /api/
and /
routes work fine.
I already searched and found this https://serverfault.com/questions/684523/nginx-multiple-roots
Thanks
Upvotes: 1
Views: 1323
Reputation: 994
No i found the right way, in case anyone else have the same problem.
server {
listen 80 default_server;
index index.html index.htm;
server_name myserver;
root /;
location / {
alias /var/www/html/;
}
location /doc {
alias /var/www/html2/;
}
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;
}
}
Upvotes: 1