ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### Portainer 如何设置 HTTPS ? 1. 参考 [安装File Browser容器](portainer/solution/filebrowser.md) 章节新建 File Browser 容器; >[danger] 注意设置 File Browser 的 volume 。 2. 在浏览器打开 File Browser ,新建一个名为 **cert** 文件夹,将证书上传至 cert; ![](http://libs.websoft9.com/Websoft9/DocsPicture/zh/potainer/portainer-ssl-1-websoft9.png) 3.修改 Nginx 的配置文件,注意将 IP 和域名改成自己的服务器 IP 和域名; upstream portainer { server 159.138.6.145:9000; } server { listen 80; listen 443 ssl; server_name test.websoft9.top; ssl_certificate /etc/nginx/cert/cert-1540972394298_test.websoft9.top.crt; ssl_certificate_key /etc/nginx/cert/cert-1540972394298_test.websoft9.top.key; location / { proxy_pass http://portainer; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Via "nginx"; } } ![](http://libs.websoft9.com/Websoft9/DocsPicture/zh/potainer/portainer-ssl-2-websoft9.png) >[warning] 如果证书路径和图中不同,请将图中证书路径改为自己的证书所在路径,并将证书名改为自己的证书名。 4. 在容器列表中重启 Nginx 容器使配置生效,就可以在浏览器内使用 https://域名 访问 Portainer 了。 5. 如果想要达到访问 http 自动跳转到 https 的效果,请将配置改成如下所示: upstream portainer { server 159.138.6.145:9000; } server { listen 80; listen 443 ssl; server_name test.websoft9.top; ssl_certificate /etc/nginx/cert/cert-1540972394298_test.websoft9.top.crt; ssl_certificate_key /etc/nginx/cert/cert-1540972394298_test.websoft9.top.key; if ($scheme != "https") { return 301 https://$host$request_uri; } location / { proxy_pass http://portainer; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Via "nginx"; } }