Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx redirect HTTPS to HTTP

How can i redireect from https to http?

i have the code below but it does not seem to work.

server {         listen 443;         server_name example.com;         rewrite ^(.*) http://example.com$1 permanent;  } 
like image 324
keno Avatar asked Aug 12 '10 17:08

keno


1 Answers

The answer above will work, you need to generate a self signed cert (or have a real one) and configure nginx as such:

server {   listen *:443;   ssl on;   server_name domain.com;   rewrite ^(.*) http://domain.com$1 permanent;    ssl_certificate      /data/certs/domain.crt;   ssl_certificate_key  /data/certs/domain.key;   } 

Keep in mind, if it is a self signed cert the browser will give you an ugly warning.

like image 74
brupm Avatar answered Sep 27 '22 20:09

brupm