简体   繁体   English

HTTPS到HTTP重定向Nginx

[英]HTTPS to HTTP redirect nginx

The problem is, the ssl certificate is expired on my local nginx server, and it will take a few days for me to get a new one. 问题是,ssl证书在我的本地nginx服务器上已过期,并且我需要几天才能获得新证书。 The website works via http, however, the browsers remember https in the cash (and there are a lot of local users). 该网站通过http运行,但是浏览器会记住现金中的https(并且有很多本地用户)。

To solve the problem, I have to force redirect https to http. 要解决此问题,我必须强制将https重定向到http。 I generated a self-signed certificate and added these lines of code: 我生成了一个自签名证书,并添加了以下代码行:

server {
  listen 443;
  server_name site.com;
  ssl on;
  rewrite ^ http://$server_name$request_uri? permanent;

  ssl_certificate /etc/ssl/site/cert.crt;
  ssl_certificate_key /etc/ssl/site/sert.key;
}

server {
    listen 80;
    ssl off;
    ....
}

The webpage via https gives Privacy error NET::ERR_CERT_AUTHORITY_INVALID 通过https的网页给出了隐私错误NET :: ERR_CERT_AUTHORITY_INVALID

I know, that browser via 443 port tries to set secure channel first and then sends http request, so I need some kind of workaround. 我知道,该浏览器通过443端口尝试首先设置安全通道,然后发送http请求,因此我需要某种解决方法。

Could anyone help? 有人可以帮忙吗?

this question is already answered 这个问题已经回答

however here you can get a free and widely accepted Certificate! 但是您可以在这里获得免费且被广泛接受的证书!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM