我有以下的nginxconfiguration:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.html index.htm; location /git { proxy_pass http://134.103.176.101:10080; include proxy_params; } }
134.103.176.101是我的第二个托pipeGitlab的服务器。 所以当我浏览http:// server1 / git我得到我的gitlab。
问题是,所有的.pngs .ttf和.woff文件都找不到。 那是因为他突然从path中删除了/ git http://server1/assets/SourceSansPro-Regular-60f619fe2b3b48b193b9047abd7f8872.ttf Failed to load resource: the server
但是我已经将GITLAB_RELATIVE_URL_ROOT设置为/ git /在我的Gitlab安装。
为什么发生这种情况? 我怎样才能得到这个图像?
谢谢! 🙂
编辑:我已经find了重写缺less的请求的解决方法
#Rewrites the request, extracting a fragment of the file name and using a remote server. location @fetchFromRemote { rewrite ^/assets/(.*)$ server1/git/assets/$1 redirect; } #Will try to see if we have the file in this server, is not will use fetchFromRemote location ~ ^/assets/.*(png|jpg|jpeg|gif|ico|swf|ttf|woff|woff2)$ { try_files $uri @fetchFromRemote; }
这适用于我,但不解决问题本身!