nginx redirect HTTPS to HTTP

前端 未结 4 372
情话喂你
情话喂你 2020-12-03 04:28

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.         


        
4条回答
  •  孤街浪徒
    2020-12-03 05:04

    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.

提交回复
热议问题