当前位置:网站首页 / 建站 / 正文

百度不支持收录https网页以及XP系统不支持SNI的解决办法

时间:2016年08月09日 | 作者 : liuhui | 分类 : 建站 | 浏览: 6962次 | 评论 0

阿里云限量代金券 | 此广告位出租25元/月

一般情况下,百度是不会收录HTTPS的网站的,谷歌就不一样,会优先收录HTTPS页面,本博客启用了SSL,百度不收录咋办?XP下IE不支持SNI SSL咋办?

方法很简单,同时开启80及443端口,通过User-agent让百度蜘蛛以及XP用户访问http网页,让一般用户访问https

下面是Nginx配置文件,分享下本博客的配置:

server
	{
		listen 80;
		server_name yongpei.wang www.yongpei.wang;
		index index.html index.htm index.php default.html default.htm default.php;
		root  /home/wwwroot/yongpei.wang;
 
#通过user-agent判断是否为Windows NT 5.x系列(2000,XP,2003),爬虫是否为百度,soso,搜狗的(均不支持https)
		if ($http_user_agent !~ (Windows\ NT\ 5.1|Windows\ NT\ 5.2|Baiduspider|sosospider|sogou|360Spider|YisouSpider|googlebot|soso|bing|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler))
			{
				rewrite ^(.*)$ https://yongpei.wang/$1 permanent;
			}
 
		include wordpress.conf;
		#error_page   404   /404.html;
		location ~ [^/]\.php(/|$)
			{
				# comment try_files $uri =404; to enable pathinfo
				try_files $uri =404;
				fastcgi_pass  unix:/tmp/php-cgi.sock;
				fastcgi_index index.php;
				include fastcgi.conf;
				#include pathinfo.conf;
			}
 
		location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
			{
				expires      30d;
			}
 
		location ~ .*\.(js|css)?$
			{
				expires      12h;
			}
 
		access_log off;
	}
 
server
	{
		listen 443 ssl spdy;
		#listen 443;
		server_name yongpei.wang www.yongpei.wang;
		index index.html index.htm index.php default.html default.htm default.php;
		root  /home/wwwroot/yongpei.wang;
		ssl on; 
		ssl_certificate /usr/local/nginx/conf/ppp.crt; 
		ssl_certificate_key /usr/local/nginx/conf/ppp.key;
		ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
		ssl_prefer_server_ciphers on;
		ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS;
		ssl_session_timeout 5m;
		ssl_session_cache builtin:1000 shared:SSL:10m;
		include wordpress.conf;
		#error_page   404   /404.html;
		location ~ [^/]\.php(/|$)
			{
				# comment try_files $uri =404; to enable pathinfo
				try_files $uri =404;
				fastcgi_pass  unix:/tmp/php-cgi.sock;
				fastcgi_index index.php;
				include fastcgi.conf;
				#fastcgi_param  HTTPS on;
				#include pathinfo.conf;
			}
 
		location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
			{
				expires      30d;
			}
 
		location ~ .*\.(js|css)?$
			{
				expires      12h;
			}
 
		access_log off;
	}

参考链接:https://yongpei.wang/118.html


推荐您阅读更多有关于“”的文章

猜你喜欢

网站分类
关注电脑博士
友情链接

分享:

支付宝

微信