Nginx configuring HTTPS for use with third-party certificates

Source: Internet
Author: User
Tags nginx ssl

Today noon boss QQ on the notice on the server needs to configure HTTPS, and then sent to do not know where to get the certificate, let me the whole.

My steps in testing the server operation are as follows:

1, check the Nginx SSL module--with-http_ssl_module is installed, if there is no need to recompile the installation.

[Email protected] ~]#/usr/local/websrv/nginx/sbin/nginx-vnginx version:nginx/1.6.3built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) TLS SNI Support enabledconfigure arguments:--user=nobody--group=nobody--with-http_ssl_module--with-http_stub_ Status_module--prefix=/usr/local/websrv/nginx-1.6.3/[[email protected] ~]#

The ok! has been installed without recompiling the installation.


2, modify the Nginx configuration file.

Create a new key directory under Nginx's CONF directory to hold the certificate.

[Email protected] ~]# Cd/usr/local/websrv/nginx-1.6.3/conf/[[email protected]/usr/local/websrv/nginx-1.6.3/conf]# mkdir key

Nginx.conf turn on SSL and add 52-55 rows to the Server tab of the site directory where you want to configure HTTPS

[Email protected]/usr/local/websrv/nginx-1.6.3/conf]# vim nginx.conf .... Listen 80; server_name test.hrfax.cn hrfax.cn;      50 51 # Add the following listen 443; + SSL on; Ssl_certificate KEY/SERVER.CRT;            Ssl_certificate_key Key/server.key; ....


3, upload the certificate to the/usr/local/websrv/nginx/conf/key directory

[email protected]/usr/local/websrv/nginx-1.6.3/conf]# ls key/server.crt server.key


4, re-reload Nginx Let the configuration take effect.

[[EMAIL PROTECTED] /USR/LOCAL/WEBSRV/NGINX-1.6.3/CONF]#  /sbin/nginx -tnginx: the configuration file /usr/local/websrv/nginx-1.6.3//conf/ nginx.conf syntax is oknginx: configuration file /usr/local/websrv/nginx-1.6.3// conf/nginx.conf test is successful[[email protected]nan1-cloud-test01 /usr/local/ WEBSRV/NGINX-1.6.3/CONF]#&NBSP, .... /sbin/nginx -s reload[[email protected] /usr/local/websrv/nginx-1.6.3/conf]# netstat  -ntlpua|grep 443       tcp         0      0 0.0.0.0:443              0.0.0.0:*                listen      1908/nginx: master 


5, the client browser test.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/89/F2/wKioL1gixz6R-RDuAAMa1IPwyHQ529.jpg-wh_500x0-wm_3 -wmp_4-s_865573571.jpg "title=" a.jpg "alt=" Wkiol1gixz6r-rduaama1ipwyhq529.jpg-wh_50 "/>

This article is from "Barley tea" blog, please be sure to keep this source http://damaicha.blog.51cto.com/6046098/1871086

Nginx configuring HTTPS for use with third-party certificates

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.