How can I get Gitlab 6.5 to show its icons under a Apache 2.4 proxy?

前端 未结 2 1138
终归单人心
终归单人心 2021-01-29 04:56

I cannot fix the icons on Gitlab bring proxied by Apache 2.4. My failure may be because I am not using passenger (passenger provided its own set of problems that were much deep

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-29 05:18

    Since it is under a relative root, you still would need to run the following as noted above in order to verify the correct mapping of the assets (which includes icons and CSS URLs):

    sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production RAILS_RELATIVE_URL_ROOT=/gitlab
    

    For you non-relative URL users, leave off the extra relative URL portion

    sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
    

    You can also restart as noted by @LpLrich :

    sudo service gitlab restart
    

    For some older Linux setups instead use:

    sudo /etc/init.d/gitlab restart
    

    Then refresh your browser.

    Yet none of the above steps worked on my system because, as best as I can say, imperfect Apache setup which I fixed below--including it in case you are finding the same issue of fixing Gitlab correctly but finding the end result failing in the browser. I did change to not using the relative URL root anymore but that doesn't matter so much. This should help Apache fix the issue above as well once the gitlab steps are completed. Sorry, the ProxyPassReverse is the main change you need to notice from the question's Apache setup:

    
    
      Servername gitlab.my_domain.com
      ServerAdmin my_admin@my_domain.com
    
      SSLCertificateFile /etc/apache2/ssl.crt/gitlab_my_domain.crt
      SSLCertificateKeyFile /etc/apache2/ssl.crt/gitlab_my_domain_private.key
      SSLCACertificateFile /etc/apache2/ssl.crt/gitlab.ca-bundle
    
      ##### All the other Apache SSL setup skipped here for StackOverflow ####
    
      ProxyPreserveHost On
    
      
        # New authorization commands for apache 2.4 and up
        # http://httpd.apache.org/docs/2.4/upgrading.html#access
        Require all granted
    
        # For relative URL root "host:your_gitlab_port/relative_root"
        #ProxyPassReverse http://127.0.0.1:8080/gitlab
        #ProxyPassReverse https://gitlab.my_domain.com/gitlab
    
        # For non-relative URL root
        ProxyPassReverse http://127.0.0.1:8080
        ProxyPassReverse https://gitlab.my_domain.com/
      
    
      # apache equivalent of nginx try files
      # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
      # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
      RewriteEngine on
      RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
      RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
      RequestHeader set X_FORWARDED_PROTO 'https'
    
      # needed for downloading attachments
      DocumentRoot /home/git/gitlab/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 503 /deploy.html
    
      LogFormat  "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
      ErrorLog      /var/log/apache2/gitlab-ssl_error.log
      CustomLog /var/log/apache2/gitlab-ssl_forwarded.log common_forwarded
      CustomLog /var/log/apache2/gitlab-ssl_access.log combined env=!dontlog
      CustomLog /var/log/apache2/gitlab-ssl.log combined
    
    
    

    (from https://github.com/gitlabhq/gitlab-recipes/blob/master/web-server/apache/gitlab-ssl-apache2.4.conf)

提交回复
热议问题