Several setup methods of the Pagoda Linux Nginx http forced jump HTTPS

Source: Internet
Author: User
Tags vps free ssl free ssl certificate ssl certificate

Recently many people are more concerned about the application and setup of SSL certificate, Spring Brother technology blog recently also introduced some of the domestic free SSL certificate application process and more commonly used VPS site environment package How to install the configuration SSL certificate. Want a friend who needs to be able to successfully install an SSL certificate for their site. Here Chun brother for everyone to share several Nginx environment forced HTTP to HTTPS setting method.

First, please find the location of the Nginx configuration file:

In fact, the configuration file location is not very difficult to find, generally in the/nginx/conf/vhost/directory, file naming is generally "your domain name. conf". Here are a few common VPS Control Panel nginx configuration file location:

Wdlinux LANMP One-click installation package:/www/wdlinux/nginx-1.10.2/conf/vhost/Directory

Military Brother Lnmp One-click installation package:/usr/local/nginx/conf/vhost/Directory

Pagoda Linux Panel:/www/server/nginx/conf/vhost/directory

Second, the Nginx environment forced HTTP to HTTPS setting method:

Method One:

The following code is a copy of the past. No need to make any changes. Spring Brother Technology Blog recommended This method, very simple, after changing the real-time effect, do not restart the server.

if ($scheme = http) {return 301 https://$host $request_uri;}

Method Two:

The following code is a copy of the past. No need to make any changes.

if ($server _port =) {return 301 https://$host $request_uri;}

Method Three:

Note the following code to change the domain name into its own domain name.

if ($ssl _protocol = "") {return 301 https://$server _name$request_uri;} if ($host! = www.wn789.com) {return 301 $scheme://www.wn789.com$request_uri;}

Method Four:

The domain name in the following code should be changed to their own domain name, do not copy completely. It is also important to note that "listen 80;" is removed from the original code.

server {
Listen 80;
server_name Wn789.xin www.wn789.xin;
Rewrite ^ (. *) https://www.wn789.xin$1 permanent;
}

Method Five:

server {
Listen 80;
server_name wn789.xin www.wn789.xin www.789wn.com 789wn.comm;
Return 301 https://$server _name$request_uri;
}

Several setup methods of the Pagoda Linux Nginx http forced jump HTTPS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.