Nginx Use HTTPS function

Source: Internet
Author: User

One: Start Nginx SSL Module 1.1 nginx If the SSL module is not turned on, you are prompted with an error when configuring HTTPS
1 nginx: [emerg] the "ssl"parameter requires ngx_http_ssl_module in/usr/local/nginx/conf/nginx.conf:37
The reason is also very simple, Nginx missing http_ssl_module module, compile and install the time with the--with-http_ssl_module configuration on the line, but now the situation is my nginx has been installed, how to add modules, in fact, is very simple, look down: Make a note: My Nginx installation directory is/usr/local/nginx this directory, my source package in the/usr/local/src/nginx-1.6.2 directory 1.2 nginx Open SSL module

Switch to the source package:

1 cd /usr/local/src/nginx-1.11.3

View Nginx's original module

1 /usr/local/nginx/sbin/nginx -V

In Configure arguments: The original configure parameters shown later are as follows:

1 --prefix=/usr/local/nginx --with-http_stub_status_module

Then our new configuration information should be written like this:

1 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_modul

Run the above command, wait for the configuration to finish

After the configuration is complete, run the command

1 make

Do not install here, or overwrite the installation

Then back up the original installed Nginx

1 cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

Then the newly compiled Nginx cover the original Nginx (this time nginx to stop the state)

1 cp ./objs/nginx /usr/local/nginx/sbin/

Then start Nginx and still be able to see if the success has been joined by the command

1 /usr/local/nginx/sbin/nginx -V 
Nginx configuration http and HTTPS coexistence
123456789 server {            listen 80 defaultbacklog=2048;            listen 443 ssl;            server_name wosign.com;            root /var/www/html;             ssl_certificate /usr/local/Tengine/sslcrt/ wosign.com.crt;            ssl_certificate_key /usr/local/Tengine/sslcrt/ wosign.com .Key;        }

Put SSL on; this line is removed and SSL is written behind port 443. This allows both HTTP and HTTPS links to be used

Nginx Configure SSL Security certificate Restart to avoid entering a password

The private key can be used to do this thing. Generate a decrypted key file instead of the original key file.

1 openssl rsa -inserver.key -outserver.key.unsecure
Nginx SSL Performance Tuning
12345 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;ssl_prefer_server_ciphers on;ssl_session_cache shared:SSL:10m;ssl_session_timeout 10m;

Reference: https://www.cnblogs.com/ghjbk/p/6744131.html

Nginx Use HTTPS function

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.