Skip to content

Instantly share code, notes, and snippets.

@alshell7
Created January 18, 2021 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alshell7/e24f17d77737062dbc04a0092d06456e to your computer and use it in GitHub Desktop.
Save alshell7/e24f17d77737062dbc04a0092d06456e to your computer and use it in GitHub Desktop.
Installing Cockpit for Ubuntu 16.04 AMI

Installing Cockpit on EC2 instance

AMI: ami-003ba08113592046f

sudo apt update

Install the package sudo apt install cockpit

Start the service sudo systemctl start cockpit

Set password for the user - ubuntu sudo passwd ubuntu

Login to https://ip-address:9090

Make sure to open the port 9090 in Security group in AWS

@alshell7
Copy link
Author

Installing SSL:

  1. Create a new NGINX conf: nano /etc/nginx/conf.d/cockpit.conf and paste this (making sure to update the FQDN for server_name and ssl certificates):
server {
        listen 9080 ssl;
        server_name twerlo.com;
    ssl_certificate /etc/letsencrypt/live/twerlo.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/twerlo.com/privkey.pem; # managed by Certbot

        # set max upload size
        client_max_body_size 2G;
        fastcgi_buffers 64 4K;

        access_log /var/log/nginx/cockpit_access.log combined;
        error_log /var/log/nginx/cockpit_error.log;

        server_tokens off;

        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;
        }
}
  1. Restart NGINX, systemctl restart nginx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment