GoGS with Apache2

First let us enable few modules that will be needed:

a2enmod proxy
a2enmod proxy_http

Sample vhosta config file for apache2:

<Directory /var/www/git.example.com>
        AllowOverride None
        Require all denied

<VirtualHost *:80>
        ServerName git.example.com
        Redirect permanent / https://git.example.com/

<IfModule mod_ssl.c>
        <VirtualHost IPADDRESS:443>
                ServerAdmin webmaster@example.com
                ServerName git.example.com:443
                SSLProxyEngine On
                ProxyPass / http://example.com:3000/
                ProxyPassReverse / http://example.com:3000/
                ErrorLog /var/www/example.com/error.log
                CustomLog /var/www/example.com/access.log combined
                SSLEngine on
                SSLCertificateFile      /etc/ssl/certs/example.com.crt
                SSLCertificateKeyFile /etc/ssl/private/example.com.key
                <FilesMatch ".(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars

                BrowserMatch "MSIE [2-6]" 
                                nokeepalive ssl-unclean-shutdown 
                                downgrade-1.0 force-response-1.0
                # MSIE 7 and newer should be able to use keepalive
                BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Let us assure that gogs is running and the restart apache

service apache2 restart


To install gogs as service we need to create file, enable it and run:

cp /home/git/goes/scripts/systemd/gogs.service /etc/systemd/system/gogs.service
systemctl enable gogs.service
systemctl start gogs.service


Leave a Reply

Your email address will not be published. Required fields are marked *