迁移GitHub page到新域名

Posted by Zeusro on October 28, 2019

手贱买了个新域名,于是博客也要改下设置.由于之前一直用阿里云解析,现在顺带转移给 cloudflare.

  1. 修改GitHub page 的setting,custom domain 改成新域名,并取消掉 enforce https (cloudflare自带证书)
  2. 找个服务器监听80端口,把旧域名的流量全部301到新域名,这里我用了docker nginx 来做
  3. 设置搜索引擎,迁移站点.如果之前还监听了HTTPS,HTTPS也要301跳转
1
2
3
4
5
6
7
8
9
version: '2.2'
services:
    blog:
      image: nginx
      ports:
      - "80:80"
      - "443:443"
      volumes:
      - "/root/migrate/nginx.conf:/etc/nginx/nginx.conf"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
user  nginx;
worker_processes auto;
pid /run/nginx.pid;
#daemon off;

events {
        worker_connections 768;
        multi_accept on;
}

http {

server {
    listen       80 ;
    server_name  www.zeusro.tech zeusro.tech;
    return       301 https://www.zeusro.com$request_uri;
}

}