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

前端 未结 2 1137
终归单人心
终归单人心 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:10

    This might help you,

    https://github.com/gitlabhq/gitlabhq/issues/3306#issuecomment-15971720

    Basically it's saying to run a rake assets:clean and then a assets:precompile and then a service gitlab restart

    I had precompiled my assets, checked the public/assets folder and could see they existed but some icons were not showing so I cleaned them out, precompiled again and restarted it then they started showing up.

    Run

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

    Then

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

    And refresh the page, if it's not working try

    sudo service gitlab restart

    But I looked in my history there now and I couldn't see myself restarting it so I am assuming that when this happened to me I simply cleaned them out and precompiled them again and I didn't have to restart.

    0 讨论(0)
  • 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:

    <IfModule mod_ssl.c>
    <VirtualHost *:443>
      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
    
      <Location />
        # 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/
      </Location>
    
      # 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
    </VirtualHost>
    </IfModule>
    

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

    0 讨论(0)
提交回复
热议问题