字数限制中间省略了一些。
server
{
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name docker.qiqimore.com ;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/docker.qiqimore.com;
...
location / {
proxy_redirect off;
proxy_pass http://portainer; # 转发规则,同 upstream 配置名称相同
proxy_set_header X-Forwarded-Host $host; # 修改转发请求头
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade; # 添加对WebSocker支持,否则域名访问后Portainer无法进入容器
proxy_set_header Connection "Upgrade"; # 同上
expires off;
sendfile off;
}
}