无法使用我自己的 url 访问 gitlab
cannot access gitlab with my own url
我尝试在我自己的网络上安装 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>
可以使用 localhost:8080
访问 gitlab,但是 git.myname.com
总是会导致带有 gitlab 徽标的内部服务器错误。 sudo /etc/init.d/apache2 start
没有魅力。我什至用相同的脚本创建了 gitlab.conf
但问题仍然存在。我该如何解决这个问题?
/var/log/apache2/error.log
表示
AH01144: No protocol handler was valid for the URL / (scheme 'http').
If you are using a DSO version of mod_proxy, make sure the proxy
submodules are included in the configuration using LoadModule.
好的,我明白了。如果您将来尝试做同样的事情,以上内容几乎就是您使用自己的 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
我尝试在我自己的网络上安装 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>
可以使用 localhost:8080
访问 gitlab,但是 git.myname.com
总是会导致带有 gitlab 徽标的内部服务器错误。 sudo /etc/init.d/apache2 start
没有魅力。我什至用相同的脚本创建了 gitlab.conf
但问题仍然存在。我该如何解决这个问题?
/var/log/apache2/error.log
表示
AH01144: No protocol handler was valid for the URL / (scheme 'http'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
好的,我明白了。如果您将来尝试做同样的事情,以上内容几乎就是您使用自己的 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