反代

docker container:

    upstream frontends {
        server 127.0.0.1:8080;
    }

    server {
        listen 80;  #监听端口
        server_name static.tonghs.com;
        location / {
            root /home/tonghs/sunflower-website;
        }
    }

    server {
        listen 80;  #监听端口
        server_name sunflower.tonghs.com;
        location / {
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends;
        }

        location = /favicon.ico {
            root /home/tonghs/sunflower-website/img;
        }
    }

docker host:

server {
    listen 80;
    server_name sunflower.tonghs.com static.tonghs.com;
    location / {
        proxy_pass http://127.0.0.1:8089;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

PHP

server {
    listen 8890;
    server_name localhost 192.168.1.123;

    root /usr/share/nginx/html;
    index index.php index.html index.htm;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}