安装 gitlab 后 js 和 css 不出现

安装 gitlab 后 js 和 css 不出现

我已经gitlab在现有的 8088 端口上安装了该软件apacheCentOS 6.5并使用了本教程https://about.gitlab.com/downloads/#centos6

因为我也在这个服务器上使用 apache,所以我修改了 apache vhost 文件,使其具有以下内容

<VirtualHost *:80>
  ServerName git.server.net
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  ProxyPreserveHost On
  AllowEncodedSlashes Off

  <Location />
    Order deny,allow
    Allow from all
    ProxyPassReverse http://127.0.0.1:8088
    ProxyPassReverse http://git.server.net/
  </Location>

  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule .* http://127.0.0.1:8088%{REQUEST_URI} [P,QSA]
</VirtualHost>

并修改/etc/gitlab/gitlab.rb为:

external_url 'http://git.server.net:8088'

# service httpd restart工作正常,但是当我执行时,# gitlab-ctl reconfigure它会引发很多警告(但一切正常),除了每个 gitlab 样式表或 js 包含都丢失,所以它看起来像这样:

css 失败

在 html 源代码中,如果我访问 css 或 js 文件,它会引发以下错误

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
 root@localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at git.server.net Port 80</address>
</body></html>

显然,nginx 应该支持parse这些文件扩展名,而 apache 则不应该:有没有办法使这个内部相对 url 引用

编辑 此相对 URL 重新格式化可以工作,但如果我手动以 url 形式访问那里,它就可以工作:如何让 gitlab 将 :8088 附加到相对 url?- http://git.server.net:8088/assets/application-2684b1e4bc7f333c28c683e130ee05f0.css

答案1

我通过将 vhost 配置更改为以下内容来修复此问题:

<VirtualHost *:80>
  ServerName git.server.net
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

  ProxyRequests off
  ProxyPass / http://git.server.net:8088/
  ProxyPassReverse / http://git.server.net:8088/
</VirtualHost>

我会把这个问题留给以后遇到这个问题的人

相关内容