How to set up remote access with cockpit and nginx #19653
-
I am trying to get the cockpit web console working with a remote connection on our server following these instructions. Right now, I can log in remotely only with an HTTP connection using the ip and 9090 port. I want to connect via HTTPS, and using the domain name instead of the ip would be nice, but I'm not sure if it's necessary or even preferable. I'm confused trying to follow the instructions. Where it says to create a virtual server block, it gives an example line of The instructions also say to put this in the the Cockpit config file:
... so would the nginx server block be referring to that, or should I use our actual domain there as well? If it is our domain, and we're setting up a subdomain name of 'cockpit', does that need to be set up in our DNS records as well? And as for the certificate, can I just copy over our website's SSL cert, or do I need to come up with a new one? Thanks for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Wrt. the certificate: The whole idea is that nginx does the reverse proxying and TLS. So from the outside, the browser talks to nginx on the configured domain name. nginx then forwards the requests to cockpit on (usually) http://localhost:9090, so cockpit itself does not speak TLS or even need a certificate. You usually use the same TLS cert for your entire site, including any subdomains (like cockpit.*). However, cockpit needs to be told what domain name it "appears" to have, so that it can compute correct links and enforce a correct "same origin" policy. It cannot detect that by itself. That's what you do with Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
OKAY! Finally figured it out. It was simply that my main server block was more specific than the subdomain server block. It had the IP and the port, whereas the subdomain block only had the port! Nginx will pick the more specific one first, as the request is coming to that IP. Now it’s working. Thanks for your help and your patience! |
Beta Was this translation helpful? Give feedback.
OKAY! Finally figured it out. It was simply that my main server block was more specific than the subdomain server block. It had the IP and the port, whereas the subdomain block only had the port! Nginx will pick the more specific one first, as the request is coming to that IP.
Now it’s working. Thanks for your help and your patience!