简体   繁体   English

在具有Plesk和Apache2的运行Ubuntu 14.04的vServer上设置GitLab 8.16.0

[英]Setting up GitLab 8.16.0 on a vServer running Ubuntu 14.04 with Plesk and Apache2

I was trying to install GitLab on my vServer and found out that it could be quite a hard task if you do not have knowledge in server administration/configuration at all. 我试图在vServer上安装GitLab,发现如果您根本不了解服务器管理/配置,这可能是一项艰巨的任务。

Task : Install GitLab 8.16.0 CE on a virtual host . 任务 :在虚拟主机上安装GitLab 8.16.0 CE。 Server is running on Ubuntu 14.04, domain management via Plesk and the webserver should be apache2 . 服务器在Ubuntu 14.04上运行通过Plesk的域管理和Web服务器应为apache2

Even several people out there had similar problems like me, it was necessary to collect the final solution from several sources. 即使有几个人也有类似我的问题,有必要从几个来源收集最终解决方案。

Following steps seem to work: 以下步骤似乎有效:

1. Add your (sub-)domain in Plesk. 1.在Plesk中添加您的(子)域。

In this example I chose the subdomain git.myVServer.com . 在此示例中,我选择了子域git.myVServer.com

2. Edit apache config 2.编辑apache配置

  • Go to the config directory 进入配置目录

     cd /etc/apache2/ 
  • Add Listen 81 to the ports.conf file Listen 81添加到ports.conf文件

  • Go to the additional config file of your vhost 转到您的虚拟主机的其他配置文件

     cd /var/www/vhosts/system/git.myVServer.com/conf/ 
  • Add a vhost.conf with following content 添加具有以下内容的vhost.conf
    (Adapted from this GitLab repo ) (改自这个GitLab仓库

     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 (ie 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 
  • Apply the changes of your vhost 应用您的虚拟主机的更改

     /opt/psa/admin/sbin/httpdmng --reconfigure-domain git.myVServer.com 
  • Restart apache 重新启动Apache

     /etc/init.d/apache2 restart 

3. Install GitLab 3.安装GitLab

  • Follow the GitLab-ce omnibus install instructions on this page . 请遵循本页上的GitLab-ce多功能安装说明。

    1. sudo apt-get install curl openssh-server ca-certificates postfix

    2. curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

    3. sudo apt-get install gitlab-ce

  • Before running the GitLab reconfiguration, we have to change some settings: 在运行GitLab重新配置之前,我们必须更改一些设置:
    cd /etc/gitlab/
    and make sure the following settings are not commented out and set to: 并确保未注释掉以下设置并将其设置为:

     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'] 
  • Apply changes: 应用更改:

     gitlab-ctl reconfigure 
  • Check if everything is fine: 检查一切是否正常:

     gitlab-ctl status 

4. Done. 4.完成。

Now, if everything went to plan, your GitLab instance should be running and you can reach it from http://git.myVServer.com 现在,如果一切按计划进行,您的GitLab实例应该正在运行,您可以从http://git.myVServer.com


Afterword : 后记
As I have no well-funded knowledge of configuring things like these, I would be happy if I get corrected wherever possible. 由于我没有足够的知识来配置类似这样的东西,因此,只要有可能得到纠正,我将很高兴。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM