【问题标题】:cannot access gitlab with my own url无法使用我自己的 url 访问 gitlab
【发布时间】:2018-11-23 19:25:42
【问题描述】:

我试图在我自己的网络上安装 gitlab 并使用我的 url 访问它,即 git.myname.com 使用 apache virtual host 。我安装了 gitlab 综合,然后用 -

更改了 gitlab.rb

external_url 'http://git.myname.com'

web_server['external_users'] = ['www-data']

ngingx['enable']=false

然后编辑/etc/apache2/sites-available/000-default.conflike -

#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 将子模块包含在配置中。

【问题讨论】:

    标签: apache gitlab virtualhost


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-26
      • 1970-01-01
      • 1970-01-01
      • 2019-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多