docker cockpit error after redirecting with nginx
Distro: Arch Linux, service app: systemctl, (cockpit is a web based system administration and docker container manager).
I recently installed cockpit on a VPS and is working great on IP:9090, later i figured out that it serves connection from localhost as http but when connected from remote it uses https with a randomly generated ssl, i wanted to serve it on a subdomain like cockpit.domain.com. So i did it by nginx using a proxy virtual block, it worked good.
But after i login, it says 'Server has closed the connection.'
How to configure cockpit to serve remote connections on a proxy?
server {
listen 80;
server_name www.cockpit.domain.com cockpit.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name www.cockpit.domain.com cockpit.domain.com;
ssl on;
ssl_certificate /path/to/certificate;
ssl_certificate_key /path/to/key;
location / {
proxy_pass http://127.0.0.1:9090;
include /etc/nginx/proxy_params;
}
}