首页 > 解决方案 > ssl找不到Gitlab-ce css和js

问题描述

我已经在 Rapsberry Pi 4 (4gb) 上安装了 Gitlab-ce,并使用 Apache2 运行它。

当我使用 http 运行它时,例如使用地址http://git.home.lan/gitlab,它工作得很好。但是,当我尝试使用 https 时,它会加载 gitlab 甚至项目,但在 /assets/ 路径中找不到 css 或 js。

某些文件,例如https://git.home.lan/gitlab/assets/highlight/themes/white-3144068cf4f603d290f553b653926358ddcd02493b9728f62417682657fc58c0.css失败,找不到 404。

当我尝试使用浏览器手动输入 css 路径时,我得到一个空白页,但浏览器控制台显示

The character encoding of the plain text document was not declared. 
The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. 
The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

当我使用 http 输入 css 路径时,它会正常加载。

apache2 sites-available conf中的配置如下:

ProxyPass         /gitlab http://127.0.0.1:9099/gitlab
ProxyPassReverse  /gitlab http://127.0.0.1:9099/gitlab
RequestHeader     add X-Forwarded-Proto https

gitlab.rb 有以下内容:

external_url 'https://git.home.lan/gitlab'

web_server['username'] = 'apache' #'gitlab-www'
web_server['group'] = 'apache' #'gitlab-www'

nginx['enable'] = false

unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 9099

 git_data_dirs({
   "default" => {
     "path" => "/mnt/[path_omitted]/git-data"
    }
 })

工作 http 设置实际上与将 https 替换为 http 相同。

我发现了一些相关的问题,但没有完全相同的问题,因此解决方案也没有奏效。

附言。我真的不知道这是否是 stackoverflow 或 raspberrypi.stackexchange 或超级用户案例,甚至是 gitlab 问题,因为我不完全理解原因。我根据此处提出的其他问题选择了 stackoverflow,但如果您认为这是错误的论坛,请保持礼貌,我会移动它。

标签: sslgitlabapache2

解决方案


推荐阅读