Home >Backend Development >PHP Tutorial >Use nginx to automatically jump to https port for http access

Use nginx to automatically jump to https port for http access

WBOY
WBOYOriginal
2016-07-29 09:11:151656browse

D Operating system: Windows 2008

NGINX version: 1.9.6

Modify nginx configuration file: nginx.conf

In http {}, create a new server, as follows

Server {

Listen 80; www.xxx.com:80;
Add the domain name you want to access the link here
Server_name www.xxx.com alias xxx.com.alias; rewrite ^(.*) https: // $ Server_name $ 1 Permanent;
This sentence is the most important
}

If there are other servers listening on 80, just change it to another port

The above introduces the use of nginx to automatically jump to the https port for http access, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn