Logs

Logs on CentOS are in /var/log/nginx/error.log.

Configuration samples

Reverse proxy at a location

How to get Nginx to forward (reverse proxy) any requests to /backend-api to another service which is running on port 8181 on the host - e.g. useful for forwarding traffic to Docker containers:

server {
    listen 80;
    listen [::]:80;

    root /var/www/services.examplecat.com/public_html;
    server_name services.examplecat.com;
    index index.html;

    location /backend-api/ {
        proxy_pass http://localhost:8181/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}