Attempting to run a git server through HTTP via Ubuntu Desktop Apache2

Viewed 31

I'm entirely new to Ubuntu and git server development, but I've been learning a lot as I go along.

I've been working on getting a git server set up and apache2 set up as well, but I can't seem to get the website to access the files I need it to.

My OS is loaded on a 120GB SSD, but my git is on a different drive all together. When I access the apache webpage, I'm met with a 403 Forbidden Error message. The git repository is in /media/rowanvr/Storage/git.git, Storage/ being my HDD. I've done chmod www-data.www-data to that location and nothing changes.

Below is the apache2.conf file; omitting the comments.

ServerName -my.ip-
DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}  
Timeout 300   
KeepAlive On    
MaxKeepAliveRequests 100

KeepAliveTimeout 5


User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

Include ports.conf


<Directory />
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride None
    Require all granted
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<Directory /media/rowanvr/Storage/git.git/>
        Options Indexes FollowSymLinks Includes ExecCGI 
        AllowOverride None
        Require all granted
</Directory>
AccessFileName .htaccess

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>


LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

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

Below here is the vhost file in sites-available

<VirtualHost *:80>

    ServerName -my.ip.com-
    DocumentRoot /media/rowanvr/Storage/git.git/
    Redirect permanent / https://-my.ip.com

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

<VirtualHost *:443>

        ServerName -my.ip.com-
        DocumentRoot /media/rowanvr/Storage/git.git/
    SSLEngine on
    
    SSLCertificateFile /etc/letsencrypt/live/-my.ip.com-/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/-my.ip.com-/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/-my.ip.com-/chain.pem

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

I've gotten access to the site before so I know it isn't a port issue. It's an issue with apache not having access to that directory despite declaring it.

I'm sure I'm forgetting something, let me know what other info I can provide! Thanks!

0 Answers
Related