Earlier this year Baidu search has been fully implemented HTTPS mode, and claimed to have been able to crawl HTTPS Web page, compared to Google has already supported the capture of HTTPS in the early years, although Baidu is a bit late, but now still has, but also some people discuss about HTTPS mode baidu Google seo impact, Although no one has given the actual test data, but Baidu Total station HTTPS mode can more or less explain Baidu's current attitude to the HTTPS site! And then cut to the point. Nginx Configure Web site SSL to implement HTTPS mode access.
Step One: Server environment, LNMP is linux+nginx+php+mysql, this article in my blog for example, using the Aliyun of the cheapest vps+ free Linux Server management system WDCP fast-built LNMP environment ( Similar products and AMH has a free version as well as the billing version, the specific installation and use methods can be found in its official forums to find detailed operational documents.
Step Two: Create your website, use LNMP environment to create your website, have the website, make sure your program can run normally under LNMP, take WordPress as example, lamp and LNMP under the pseudo static rule is different, have had the replacement, want to remember to switch.
Step three: Apply for a free SSL certificate, the application of SSL certificate, before someone has given a detailed tutorial, specific details can be Baidu Vauton SSL certificate.
Fourth Step: Configure Web site SSL, find the Nginx profile of the Web site you need to configure SSL, take WDCP as an example configuration file in/www/wdlinux/nginx/conf/vhost/directory, add the following code to the Web site's profile server, At the same time in order to facilitate management, you need to apply the Nginx under the SSL certificate uploaded to the/www/wdlinux/nginx/conf/directory, different management systems or manually configured LNMP environment This directory is not the same, please adjust according to your actual situation.
SSL on;
Ssl_certificate_key/www/wdlinux/nginx/conf/pastdust.key;
SSL_CERTIFICATE/WWW/WDLINUX/NGINX/CONF/PASTDUST.CRT;
Because SSL does not access the 80 port of the traditional Web site, but 443 port will need to continue to add 443 ports to the website in the configuration file, in order to conveniently do not know where to put the above in the configuration file, the following will be my site complete configuration file posted, can be modified according to your actual situation.
server {
Listen 80;
Listen 443;
server_name pastdust.com www.***.com;
root/www/web/pastdust_com/public_html;
Index index.html index.php index.htm;
Error_page 400/errpage/400.html;
Error_page 403/errpage/403.html;
Error_page 404/errpage/404.html;
SSL on;
Ssl_certificate_key/www/wdlinux/nginx/conf/pastdust.key;
SSL_CERTIFICATE/WWW/WDLINUX/NGINX/CONF/PASTDUST.CRT;
Location ~ \.php$ {
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fcgi.conf;
}
Include rewrite/***.conf;
}
Confirm that all the changes are correct, restart Nginx basically this time your site will be able to access through SSL, but there are some details to be adjusted, such as the above Web site configuration file is HTTP and HTTPS mode coexist, but also need to do a jump, All accesses to HTTPS mode for the HTTP mode of the item.
Fifth Step: Site mandatory access to HTTPS mode, for example, WordPress, the following jump code added to the current site all the use of pseudo-static rules conf file, you can achieve all HTTP access to the HTTPS access, and is the inheritance directory, The way to achieve this is to redirect HTTP mode access to 301 to HTTPS mode.
if ($server _port = 80) {
return https://$server _name$request_uri;
}
if ($scheme = http) {
return https://$server _name$request_uri;
}
Error_page 497 https://$server _name$request_uri;
By this time, when you visit some pages of your site, use the Chrome browser as an example, some of the page https will not show Green, the show is X or yellow, because you are inside the site such as CSS files, chain pictures and other uses are still HTTP mode, and then is the last step, Total Station HTTPS.
Sixth step: Whole station HTTPS, to WordPress as an example, the first is to modify the site theme of all the HTTPS link elements, and then in the database to bulk replace the SSL added before the picture attachment, SQL commands are as follows:
UPDATE wp_posts SET post_content = replace (post_content, ' http://www.***.com ', ' https://www.***.com ');
The above six can realize the LNMP Web site SSL configuration, and let the whole station HTTPS mode access, specific about HTTPS mode access in Baidu SEO this piece of performance, need to wait for some time data, because up to this post position, I also just just blog https, There is a need to refer to the final implementation of the results can refer to my blog, all the code changes are original sharing has no reservations, and welcome everyone to discuss the message.
Original address: https://www.pastdust.com/nginx-ssl-https/Welcome reprint but please note source