nginx port 80 jumps to 443 url to keep the configuration

Most financial website access generally does not open the access of the http protocol, but only provides the access of the https protocol, but sometimes users may inadvertently access the url under http. Function, for a website with nginx as the front-end server, the general configuration is as follows, the port 80 can be directly jumped to 443, the specific configuration code is as follows:

 

 

  server {
         listen  80;
         server_name xxx.com *.xxx.com;

         rewrite ^(.*)$  https://$http_host$1 permanent;
  }

 xxx.com represents the domain name of the website

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326644659&siteId=291194637