尝试通过Ubuntu桌面Apache通过HTTP运行GIT服务器2

发布于 2025-01-25 23:10:15 字数 2674 浏览 5 评论 0原文

我是Ubuntu和Git Server开发的新手,但是随着我的发展,我一直在学到很多东西。

我一直在努力设置Git服务器并设置Apache2,但是我似乎无法让网站访问我需要的文件。

我的操作系统装在120GB SSD上,但我的git却在不同的驱动器上。当我访问Apache网页时,我会遇到403禁止错误消息。 git存储库位于/media/Rowanvr/storage/git.git.git中,存储/是我的HDD。我已经完成了chmod www-data.www-data到该位置,没有任何变化。

以下是apache2.conf文件;省略评论。

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

以下是我之前可以在网站上

<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>

访问该网站的VHOST文件,因此我知道这不是端口问题。这是Apache尽管宣布该目录的问题。

我确定我忘记了一些东西,让我知道我还能提供哪些信息! 谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文