Configure Nginx Reverse Proxy behind Cloudflare

On reverse proxy server, lets install some basic utilities.

Install nginx

Now create a config file

Add following to the file and save

In above replce following

Next create a self signed SSL certificate for the web site

Restart nginx

At this stage, you can login to cloudflare, point IP of the web site to reverse proxy server IP address.

Show real IP address

When running a site behind reverse proxy, by default, web server shows IP of the revese proxy server instead of real visitor IP. To fix this, you need to configure remoteip module.

On Cpanel server, edit file

Find

Add your proxy server IP after.

Example

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

Leave a Reply

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