Nginx config - serving index.html not working
Basically, the root
directive (inside the location block) didn't mention the full path. Also, a ;
is missing at the end of index
directive (could be a typo, nginx usually catches these typos).
So, your server config located in sites-enabled would look like this (after the above two changes)...
server { root /home/www/public; listen 80; server_name localhost; index index.html index.htm; # proxy request to node location @proxy { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:3010; proxy_redirect off; break; } location / { try_files $uri $uri/ @proxy; } # rest of the configuration # ... # ... }