I would like to reverse proxy my NodeJS backend through NGINX, but I keep getting the 403 Forbidden Error, logged by NGINX as
[error] 10#10: *1 directory index of "/usr/share/nginx/html/" is forbidden, client: 172.20.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8888 My configuration for the server block:
server { charset utf8; listen 80 default_server; location / { proxy_pass http://localhost:5000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache_valid 200 1s; } location /assets/ { expires 30d; add_header Cache-Control "public"; root /usr/share/nginx/html/; try_files $uri =404; } } After doing some research, it seems like it may be related to NGINX identifying / as a query for a directory listing and would most likely require me to add index index.html to solve the issue (it didn't). My configuration also matches that presented by the official NGINX configurations for reverse proxies.
Does anyone have an idea how to solve this?
Any help would be greatly appreciated! Cheers :)
localhost:8888part of the error message. You should also test your configuration usingnginx -Tnginx -Tprintout here.