Nginx Proxy Configuration

To configure Nginx as a proxy, use the following configuration

If you need to serve images using static files, add the following block to Nginx config

Rule to handle SSL verification

If you are proxying traffic to an application server, you may need Nginx to handle requests for SSL verification. In that case, add the following to the server block, above location / entry.

Example

https://gist.github.com/serverok/8fb73df8135774f292bb2cc86446ae2c

Nginx Rails Origin header didn’t match request.base_url

HTTP to HTTPS Redirect

If you do proxying on HTTPS, then you can use following config for HTTP to handle SSL verification and redirect to HTTPS.

Nginx Proxy Config with Caching

Here is Nginx proxy config with caching.

If cookie “myCookie” is present, nginx won’t serve cached page to that visitor.

Back to Nginx

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *