【问题标题】:Setting up GitLab 8.16.0 on a vServer running Ubuntu 14.04 with Plesk and Apache2在运行带有 Plesk 和 Apache2 的 Ubuntu 14.04 的 vServer 上设置 GitLab 8.16.0
【发布时间】:2017-01-23 12:18:22
【问题描述】:

我试图在我的 vServer 上安装 GitLab,发现如果您根本不具备服务器管理/配置方面的知识,这可能是一项艰巨的任务。

任务:在虚拟主机上安装GitLab 8.16.0 CE。服务器在 Ubuntu 14.04 上运行,通过 Plesk 进行域管理,并且网络服务器应该是 apache2

即使有几个人和我一样有类似的问题,有必要从多个来源收集最终解决方案。

【问题讨论】:

    标签: apache ubuntu-14.04 gitlab plesk vhosts


    【解决方案1】:

    以下步骤似乎有效:

    1。在 Plesk 中添加您的(子)域。

    在本例中,我选择了子域git.myVServer.com

    2。编辑 apache 配置

    • 进入配置目录

      cd /etc/apache2/
      
    • Listen 81 添加到ports.conf 文件

    • 转到您的虚拟主机的附加配置文件

      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
      
    • 应用您的虚拟主机的更改

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

      /etc/init.d/apache2 restart
      

    3。安装 GitLab

    • 按照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

    • 在运行 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
      

    4。完成。

    现在,如果一切按计划进行,您的 GitLab 实例应该正在运行,您可以从 http://git.myVServer.com


    后记
    由于我没有足够的知识来配置这些东西,如果我能尽可能得到纠正,我会很高兴。

    【讨论】:

    • 嗯.. 我无法正确设置代码块的样式。如何转义类似 HTML 的部分,例如 &lt;Location /&gt;
    猜你喜欢
    • 2015-11-20
    • 1970-01-01
    • 1970-01-01
    • 2014-06-21
    • 2017-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-01
    相关资源
    最近更新 更多