Reverse Proxy with NginX

This configuration will listen for incoming requests on port 80 and forward them to a backend server running on localhost at port 8000. It will also set the Host, X-Real-IP, and X-Forwarded-For headers to the appropriate values so that the backend server can get the correct information about the incoming request.

This is just a basic example, and you can customize the configuration further to suit your needs. For example, you can add additional location blocks to handle different paths or add SSL/TLS support.

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://localhost:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

with SSL support

server {
    listen 443 ssl http2;
    server_name example.com;

    ssl_certificate /path/to/certificate.crt;
    ssl_certificate_key /path/to/private.key;

    location / {
        proxy_pass http://localhost:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

This configuration will listen for incoming requests on port 443 using SSL/TLS and HTTP/2. It will use the certificate and private key located at the specified paths to encrypt the traffic. The rest of the configuration is the same as the previous example.

You can also customize the SSL/TLS configuration further by using other directives such as ssl_protocols, ssl_ciphers, and ssl_prefer_server_ciphers. Refer to the NGINX documentation for more information on these directives and other options for configuring SSL/TLS.