我试图在我的vServer上安装GitLab,并发现如果你根本不了解服务器管理/配置,这可能是一项非常艰巨的任务。
任务:在虚拟主机上安装 GitLab 8.16.0 CE。服务器通过 Plesk 在 Ubuntu 14.04 域管理上运行,网络服务器应为 apache2 。
即使有几个人也有类似我的问题,有必要从多个来源收集最终解决方案。
答案 0 :(得分:0)
以下步骤似乎有效:
在此示例中,我选择了子域git.myVServer.com
。
转到配置目录
cd /etc/apache2/
将Listen 81
添加到ports.conf
文件
转到vhost的其他配置文件
cd /var/www/vhosts/system/git.myVServer.com/conf/
添加一个vhost.conf,内容如下 (改编自GitLab repo)
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
ServerName http://git.myVServer.com
ServerSignature Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Location \>
Require all granted
#Allow forwarding to gitlab-workhorse
ProxyPassReverse http://127.0.0.1:8081
ProxyPassReverse http://git.myVServer.com:81
</Location>
RewriteEngine on
#Forward all requests to gitlab-workhorse except existing files like error documents
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
# needed for downloading attachments
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
#Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
ErrorDocument 404 /404.html
ErrorDocument 422 /422.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 503 /503.html
# It is assumed that the log directory is in /var/log/httpd.
# For Debian distributions you might want to change this to
# /var/log/apache2.
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
ErrorLog /var/log/apache2/gitlab_error.log
CustomLog /var/log/apache2/gitlab_forwarded.log common_forwarded
CustomLog /var/log/apache2/gitlab_access.log combined env=!dontlog
CustomLog /var/log/apache2/gitlab.log combined
应用vhost的更改
/opt/psa/admin/sbin/httpdmng --reconfigure-domain git.myVServer.com
重启apache
/etc/init.d/apache2 restart
按照this page上的GitLab-ce omnibus安装说明进行操作。
sudo apt-get install curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
在运行GitLab重新配置之前,我们必须更改一些设置:
cd /etc/gitlab/
并确保未注释掉以下设置并将其设置为:
external_url 'http://git.myVServer.com'
gitlab_url = 'http://127.0.0.1:8081'
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"
unicorn['port'] = 8081
nginx['enable'] = false
web_server['external_users'] = ['www-data']
应用更改:
gitlab-ctl reconfigure
检查一切是否正常:
gitlab-ctl status
现在,如果一切按计划进行,您的GitLab实例应该正在运行,您可以从中获取
http://git.myVServer.com
<强>后记强>:
由于我没有很好的资源配置这样的事情,如果我尽可能得到纠正,我会很高兴。