I want to call the index.html from the folder /var/www/fileUpload/html. The index.html file exists in that folder.
The / router works. the uploadFiles route as well. But when I open the upload route I get a 404 error.
server{ listen 80; server_name xx.xx.xxx.xxx; location / { root /var/www/kioskJPE/html; index index.html; } location /upload { root /var/www/fileUpload/html; index index.html; } location /uploadFiles { proxy_pass http://localhost: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; } }
Do you have any suggestions? Thank you!
Advertisement
Answer
That should be alias /var/www/fileUpload/html;
otherwise Nginx is looking for the file in /var/www/fileUpload/html/upload/index.html
. See this document for details.
For example:
location /upload { alias /var/www/fileUpload/html; }