- A+
所属分类:网站seo
说到https,以前用多说评论插件留下很多后遗症,比如多说条用第三方头像图片地址、表情包地址,而第三方并不支持https(SSL)。
换域名也很简单:
1.将全站数据(包括数据库)打包
2.上传网站文件至新服务器
3.导入数据库,并修改一些配置
4.执行sql批量处理命令语句(将原域名全部换成新域名):
1
2 3 |
UPDATE wp_options SET option_value = replace( option_value, 'http://feiyu2.com', 'https://feiyu2.com' ) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace( post_content, 'http://feiyu2.com', 'https://feiyu2.com' ) ; UPDATE wp_posts SET guid = replace( guid, 'http://feiyu2.com', 'https://feiyu2.com' ) ; |
修改Nginx配置文件:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
server
{ listen 80; if ($server_port = 80) { return 301 https://feiyu2.com$request_uri; } listen 443 ssl http2; #listen [::]:80; ssl on; ssl_certificate /home/wwwroot/laod.org.crt; ssl_certificate_key /home/wwwroot/feiyu2.com.key; server_name laod.org www.feiyu2.com; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/feiyu2.com; ..... |
在Nginx 1.9.x以上版本已支持HTTP/2,我的Nginx版本为1.10.0,所以直接在listen后面加http2即可
1
|
listen 443 ssl http2;
|
全部完成重启即可。