Nginx configuration NameCheap free SSL
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
cd /usr/local/nginx/conf/openssl genrsa -out imcat.pem 2048
2. Generate the csr File
Openssl req-new-key imcat. pem-out imcat. csrCountry Name (2 letter code) [AU]: CN // enter the country abbreviation State or Province Name (full name) [Some-State]: JiangXi // 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) []: // you do not need to enter Common Name (eg, YOUR name) []: jungehost.com // enter the domain Name for ssl configuration, such as yangxinlin.cn. Note that ya Ngxinlin.cn and www.yangxinlin.cn belong to different domain names. Email Address []: admin@yangxinlin.cn // enter your mailbox Please enter the following 'extra 'attributesto be sent with your certificate requestA challenge password []: // you do not need to enter An optional company name []: // you do not need to enter
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 ,:
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 !)
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.
After pressing Next, you can now receive the email
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/
5. then execute the following command to merge the certificate
cat imcat_in.crt>>PositiveSSLCA2.crtrm -rf imcat_in.crtmv PositiveSSLCA2.crt imcat_in.crt
6. Change Nginx Configuration
server{listen 443;server_name imcat.in *.imcat.in;index index.PHP index.htm ;root /home/www/imcat/;ssl on;ssl_certificate imcat_in.crt;ssl_certificate_key imcat.pem;location / {try_files $uri $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.