首页 文章

无法使用我自己的网址访问gitlab

提问于
浏览
1

我试图在我自己的网络上安装gitlab并使用我的url即git.myname.com使用apache虚拟主机访问它 . 我安装了gitlab omnibus,然后使用 - 更改了gitlab.rb

external_url'http://git.myname.com'web_server ['external_users'] = ['www-data'] ngingx ['enable'] = false

然后编辑 /etc/apache2/sites-available/000-default.conf 喜欢 -

#LogLevel alert rewrite:trace6
#RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/repository/archive [OR]
#RewriteCond %{REQUEST_URI} ^/api/v3/projects/.*/repository/archive [OR]
#RewriteCond %{REQUEST_URI} ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$
#RewriteRule .* http://localhost:8081%{REQUEST_URI} [P,QSA]

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


<VirtualHost *:80>
  ServerName git.myname.com
  ServerSignature Off
  ProxyPreserveHost On

  <Location />
    Require all granted

    ProxyPassReverse http://127.0.0.1:8080
    ProxyPassReverse http://git.myname.com/
  </Location>

  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]

  # needed for downloading attachments
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

</VirtualHost>

gitlab可以通过 localhost:8080 访问,但 git.myname.com 始终会导致gitlab徽标出现内部服务器错误 . sudo /etc/init.d/apache2 start 没有魅力 . 我甚至用相同的脚本创建了 gitlab.conf 但仍然是问题 . 我该如何解决这个问题?

/var/log/apache2/error.log

AH01144:没有协议处理程序对URL /(方案'http')有效 . 如果您使用的是DSO版本的mod_proxy,请确保使用LoadModule在配置中包含代理子模块 .

1 回答

  • 1

    好的,我弄明白了这个问题 . 如果您将来尝试这样做,上面几乎是您需要遵循使用您自己的URL托管gitlab服务器 . 通过运行以下命令可以解决此问题

    sudo a2enmod proxy_html
    sudo a2enmod proxy
    sudo a2enmod rewrite
    sudo a2enmod proxy_balancer
    sudo a2enmod proxy_connect
    sudo a2enmod proxy_html
    sudo a2enmod proxy_headers
    sudo a2enmod headers
    sudo a2enmod proxy_ajp
    
    sudo systemctl restart apache2
    

相关问题