autorenew

Common Nginx Commands

1. Restart

/usr/nginx/sbin/nginx -s reload

2. Check Configuration File Validity

nginx -t -c /usr/nginx/conf/nginx.conf

Or

/usr/nginx/sbin/nginx -t

3. Proxy Configuration

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://localhost:8080;  # Spring Boot application address
        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_set_header X-Forwarded-Proto $scheme;
    }
}

proxy_set_header can proxy access permissions and request headers. This configuration is essential when the backend has a whitelist.