我有一个服务器(Ubuntu-Server),带有一些基于 Docker 的服务器(Gitlab、Redmine)和 NGINX 作为代理。
gitlab.<myserver> => NGINX -> <docker-net-ip>:port => Gitlab-container
redmine.<myserver> => NGINX -> <docker-net-ip>:port => Redmine-container
SQL-container
Certbot
这就像一个魅力。现在我想通过 Cockpit Web Service 扩展我的服务器:
cockpit.<myserver> => NGINX -> localhost:9090 => Cockpit running on the server
gitlab.<myserver> => NGINX -> <docker-net-ip>:port => Gitlab-container
redmine.<myserver> => NGINX -> <docker-net-ip>:port => Redmine-container
SQL-container
Certbot
我为驾驶舱添加了一个额外的 NGINX 规则(对应于https://github.com/cockpit-project/cockpit/wiki/Proxying-Cockpit-over-NGINX),然后驾驶舱可用,但 Redmine 和 Gitlab 都没有。如果我删除规则,反之亦然。
在/etc/nginx/sites-available/和/etc/nginx/sites-enabled/中存储了以下 NGINX 规则:
gitlab.<我的服务器>
server {
listen 80;
listen [::]:80;
server_name gitlab.<myserver>;
location / {
proxy_pass http://<docker-net-ip>:port;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
}
}
redmine.<我的服务器>
server {
listen 80;
listen [::]:80;
server_name redmine.<myserver>;
location / {
proxy_pass http://<docker-net-ip>:port;
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 X-Forwarded-Proto $scheme;
}
}
现在我添加了:
cockpit.<myserver>
server {
listen 80;
listen 443 ssl;
server_name cockpit.<myserver>;
location / {
# Required to proxy the connection to Cockpit
proxy_pass https://127.0.0.1:9090;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
# Required for web sockets to function
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Pass ETag header from Cockpit to clients.
# See: https://github.com/cockpit-project/cockpit/issues/5239
gzip off;
}
}
和/etc/cockpit/cockpit.conf
[WebService]
Origins = https://cockpit.<myserver> 127.0.0.1:9090
ProtocolHeader = X-Forwarded-Proto
[Log]
Fatal = /var/log/cockpit.log
[Session]
IdleTimeout=15
这里缺少什么?