Https to Http Redirection In Nginx
So how do you redirect https to http in Nginx? This is generally the opposite of what everybody does http to https redirection. Sometimes it is required to run all your service under http only so in that case you need to do a redirection. This procedure explains the method to achieve the redirection.
Process to Redirect Https to Http in Nginx
I am assuming that you are already familiar with the configuration of Nginx server. So here we are going to modify the nginx.conf file which is the main configuration file for Nginx. Open this configuration file and follow the instruction below.
In the https server module of your configuration file you need to add a redirection rule which would permanently rewrite the URL to http. So find the example configuration below:
rewrite ^ http://$server_name$request_uri? permanent; //Magic line
This is a permanent redirection from https to http so whatever request goes to https URL, those requests will be redirected to http permanently.
Did you see how simple was that, sometimes a simple trick could do a big job for you. This configuration is mostly useful for those bloggers and webmasters who run their blog on VPS server and use Nginx as a load balancer.