Nginx Add SSL Service method

Source: Internet
Author: User

1. Copy the requested SSL encryption certificate file to the Nginx conf directory

such as: Server.pem, Server.key

2.vim nginx.conf

Example:

server { Listen 443 SSL; #Listen;server_name www.test.com; ssl_certificate Server . Pem;        Ssl_certificate_key Server.key;        Ssl_session_cache shared:ssl:1m;        Ssl_session_timeout 10m;       Ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; Ssl_ciphers rc4:high:!anull:! MD5;        Ssl_prefer_server_ciphers on; Root/mnt/html/test; Index index. PHP index.html Index.htm; Access_log logs/test.com_access.Log; Error_logLogs/test.com_error.LogDebug; Error_page502 503 504/50x.html; Location=/50x.HTML {root/mnt/html; }        # redirectLocation/ {                if(!-E$request _filename) {rewrite^/(. *) $/index.php/$1Last ; }        }        Location~ \.php {fastcgi_pass127.0.0.1:9000; Fastcgi_index Index.PHP; includeFastCGI.conf; }        }

3. Configure HTTP redirection to HTTPS

server {    listen  ;    server_name www. test.com test. com;     ^ (. *) $  https://www.test.com$1 permanent;}

4. Restart Nginx to fix

Nginx Add SSL Service method

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.