Nginx Install Configure SSL certificate and force HTTP to jump to HTTPS

Source: Internet
Author: User
Tags ssl certificate

Request a free HTTPS certificate https://login.wosign.com/reg.html

First check if Nginx has installed Http_ssl_module, I this is installed HTTPS module, if not this module requires Nginx smooth upgrade to add SSL to implement the station HTTPS.

can refer to http://www.open-open.com/lib/view/open1451624143370.html

Successful application will let you retrieve the certificate, my is Nginx, so the certificate natural selection for Nginx, upload to a folder under the server, Nginx folder below is the best choice, and then configure the nginx.conf file

Restart Lnmp Reload Try Https://www.usshare.cn

The description takes effect, but at this point HTTP can also access HTTPS, this is also necessary to do some settings, let its HTTP force jump to HTTPS

nginx Config http force jump to HTTPS (actually do a 301 jump)

Purpose: Force automatic jump to https://sdk.open.test.com/when accessing http://sdk.open.test.com/

Modify Nginx Site configuration file sdk.open.test.com.conf

Server
{
listen;
server_name sdk.open.test.com;
Return 301 https://$server _name$request_uri;
      Rewrite ^/(. *) https://ssl.lanbing.org/$1 permanent;  #关键代码仔细比较两者的跳转的区别
}

server
{
listen 443 SSL;
server_name sdk.open.test.com;
Index index.html index.htm index.php;
root/data/www/web/;
CharSet Utf-8;

Location ~.*\.  (Swf|xml|mp3|png|jpg|gif|data) $ {
expires Max;
} location

~.*\.  (CSS|JS|MX) $ {
expires 96h;
} Location-

/.svn/{
deny all;
} location

~. *\.php$
{ 
include fastcgi.conf;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Expires off;
}

SSL on;
SSL_CERTIFICATE/USR/LOCAL/NGINX/SSL/EA93BALK25XH3F9.CRT;
Ssl_certificate_key/usr/local/nginx/ssl/9yrt62bv1z4s35la.key;

Access_log/data/logs/sdk.open.test.com.access.log access;
Error_log   /data/logs/sdk.open.test.com.error.log warn;
}


"detail Reference" Nginx enforces access to http://blog.csdn.net/wzy_1988/article/details/8549290 using 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.