I. Installation Requirements
1. Nginx has compiled the ssl module. If not, re-compile the module.
2. You have purchased an SSL certificate (nonsense)
II. Start installation
1. Mr. Cheng's own KEY
The code is as follows: |
Copy code |
Cd/usr/local/nginx/conf/ Openssl genrsa-out imcat. pem 2048 |
2. Generate the csr file
Openssl req-new-key imcat. pem-out imcat. csr
The code is as follows: |
Copy code |
Country Name (2 letter code) [AU]: CN // enter Country abbreviation State or Province Name (full name) [Some-State]: JiangXi // Province/city Locality Name (eg, city) []: JiuJiang // city Organization Name (eg, company) [Internet Widgits Pty Ltd]: Yangxinlin // Organization Name or company Name Organizational Unit Name (eg, section) []: // optional Common Name (eg, YOUR name) []: jungehost.com // enter the domain Name for which ssl is to be configured, for example, 111cn.net. Note that 111cn.net and www.111cn.net belong to different domain names. Email Address []: admin@yangxinlin.cn // enter a mailbox Please enter the following 'Extra 'attributes To be sent with your certificate request A challenge password []: // optional An optional company name []: // optional |
3. Go to the Namecheap website to enable the SSL certificate
Go to the Namecheap website and click Your ssl certificates under My Account in the SSL Certificates menu, as shown in the figure:
Namecheap Comodo PositiveSSL 01 install NameCheap Free SSL on Nginx
Select an SSL authentication service that you have never used and click the Active link on the right to apply for activating your SSL authentication. (If it has been enabled, you can issue a new issue and select Reissue. It will soon expire !)
Install NameCheap Free SSL on Nginx
Next, we will send an authentication signature request file to Namecheap to complete the activation process. If the Web server software does not have Nginx, only select other. Enter imcat in the csr below. the content of the csr, that is, the content that needs to be copied starting with ----- begin certificate request ----- to ----- end certificate request.
Imcat2 install NameCheap Free SSL on Nginx
After pressing Next, you can now receive the email
Imcat3 install NameCheap Free SSL on Nginx
It is best to submit the certificate directly, wait for the verification email to be received, and enter the verification code of the email to get the SSL certificate.
4. Extract the SSL certificate from NameCheap and upload it to/usr/local/nginx/conf/
Install NameCheap Free SSL on Nginx
5. Then execute the following command to merge the certificate
The code is as follows: |
Copy code |
Cat imcat_in.crt> PositiveSSLCA2.crt Rm-rf imcat_in.crt Mv PositiveSSLCA2.crt imcat_in.crt |
6. Change Nginx configuration
The code is as follows: |
Copy code |
Server { Listen 443; Server_name imcat. in *. imcat. in; Index. php index.htm; Root/home/www/imcat /; Ssl on; Ssl_certificate imcat_in.crt; Ssl_certificate_key imcat. pem; Location /{ Try_files $ uri // index. php; Location ~ . Php $ { Fastcgi_pass unix:/tmp/php-cgi.sock; Fastcgi_index index. php; Fastcgi_param HTTPS on; Include fastcgi. conf; } } Location ~ . *. (Gif | jpg | jpeg | png | bmp | swf | js | css | ttf | woff) $ { Expires 30d; } Access_log/home/logs/imcat. in. access. log; } |
7. Restart nginx.
Imcat4 install NameCheap Free SSL on Nginx