Musimy uruchomić odpowiednie moduły proxy dla apache:
a2enmod proxy a2enmod proxy_http
Przykładowy plik konfiguracyjny vhosta apache2:
<Directory /var/www/git.example.com> AllowOverride None Require all denied </Directory> <VirtualHost *:80> ServerName git.example.com Redirect permanent / https://git.example.com/ </VirtualHost> <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 </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> 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 </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Upewnijmy się, że gogs jest uruchomiony i zrestartujmy apache
service apache2 restart
Zainstalujmy gogs jako usług i uruchommy ją:
cp /home/git/goes/scripts/systemd/gogs.service /etc/systemd/system/gogs.service systemctl enable gogs.service systemctl start gogs.service