Skip to main content

How I Set Up Gogs on Ubuntu 14.04

2 min read

Basically followed along with How To Set Up Gogs on Ubuntu 14.04.

 

However, installation to a Raspberry Pi B 2 running Mail In A Box requires some adjustments.

 

  1. Get an ARM Go binary instead (version 1.6.3 suitable at time of whatever–this–is);
    wget https://storage.googleapis.com/golang/go1.6.3.linux-armv6l.tar.gz
  2. Nginx configuration with added TLS;
    ./certbot-auto certonly -w /home/cn/domains/[server name] -d [server name] -a webroot
    sudoedit /etc/nginx/conf.d/gogs.conf
    server {
        listen 80;
        server_name [server name];
    
        proxy_set_header X-Real-IP  $remote_addr; # pass on real client IP
    
    	location / {
    		# Redirect using the 'return' directive and the built-in
    		# variable '$request_uri' to avoid any capturing, matching
    		# or evaluation of regular expressions.
    		return 301 https://$server_name$request_uri;
    	}
    
        location /.well-known/acme-challenge/ {
    	# This path must be served over HTTP for ACME domain validation.
    	# We map this to a special path where our TLS cert provisioning
    	# tool knows to store challenge response files.
    	root /home/cn/domains/[server name];
        }
    }
    
    # The secure HTTPS server.
    server {
    	listen 443 ssl;
    	listen [::]:443 ssl;
    
    	server_name [server name];
    
    	# Improve privacy: Hide version an OS information on
    	# error pages and in the "Server" HTTP-Header.
    	server_tokens off;
    
    	ssl_certificate /etc/letsencrypt/live/[server name]/fullchain.pem;
    	ssl_certificate_key /etc/letsencrypt/live/[server name]/privkey.pem;
    
        location / {
            proxy_pass http://localhost:3000;
        }
    
    }
  3. Supervisor config without appending to the main file;
    sudoedit /etc/supervisor/conf.d/gogs.conf

It will be no surprise to me if I’ve missed a step that I changed.