备案域名跨服务器的部署技巧


只要不是转到80端口,就不影响备案。

1、已备案的服务器配置:

server {
    listen 80;
    server_name sichuanshuaka.com;

    # charset koi8-r;

    access_log  logs/host.access.log  main;

    location / {
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X_Real_IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://111.111.111.111:20280;
    }
}

2、实际部署的服务器配置(rancher + docker + nginx):

server {
    listen       20280; # 非 80 端口
    server_name  www.sichuanshuaka.com;

    access_log  logs/host.access.log  main;
    location / {
        resolver 222.222.222.222 valid=5s ipv6=off;
        set $backend "sichuan-www.platforms";

        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X_Real_IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://$backend:9000;
    }
}

前一篇:
后一篇:

发表评论