Commit 582646ff956d8064eb6eec1c9043322a9f2cb3f9

Authored by Sytse Sijbrandij
2 parents c91300e4 636ec6d3

Merge branch 'gzip_assets_warning' into 'master'

Gzip assets warning for relative urls
config/application.rb
@@ -66,13 +66,16 @@ module Gitlab @@ -66,13 +66,16 @@ module Gitlab
66 # Version of your assets, change this if you want to expire all your assets 66 # Version of your assets, change this if you want to expire all your assets
67 config.assets.version = '1.0' 67 config.assets.version = '1.0'
68 68
  69 + # Relative url support
69 # Uncomment and customize the last line to run in a non-root path 70 # Uncomment and customize the last line to run in a non-root path
70 # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. 71 # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this.
71 - # Note that four settings need to be changed for this to work. 72 + # Note that following settings need to be changed for this to work.
72 # 1) In your application.rb file: config.relative_url_root = "/gitlab" 73 # 1) In your application.rb file: config.relative_url_root = "/gitlab"
73 # 2) In your gitlab.yml file: relative_url_root: /gitlab 74 # 2) In your gitlab.yml file: relative_url_root: /gitlab
74 # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" 75 # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
75 # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab" 76 # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab"
  77 + # 5) In lib/support/nginx/gitlab : do not use asset gzipping, remove block starting with "location ~ ^/(assets)/"
  78 + #
76 # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production 79 # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
77 # 80 #
78 # config.relative_url_root = "/gitlab" 81 # config.relative_url_root = "/gitlab"
config/gitlab.yml.example
@@ -24,15 +24,8 @@ production: &base @@ -24,15 +24,8 @@ production: &base
24 # Otherwise, ssh host will be set to the `host:` value above 24 # Otherwise, ssh host will be set to the `host:` value above
25 # ssh_host: ssh.host_example.com 25 # ssh_host: ssh.host_example.com
26 26
27 - # Uncomment and customize the last line to run in a non-root path  
28 - # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this.  
29 - # Note that four settings need to be changed for this to work.  
30 - # 1) In your application.rb file: config.relative_url_root = "/gitlab"  
31 - # 2) In your gitlab.yml file: relative_url_root: /gitlab  
32 - # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"  
33 - # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab"  
34 - # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production  
35 - # 27 + # WARNING: See config/application.rb under "Relative url support" for the list of
  28 + # other files that need to be changed for relative url support
36 # relative_url_root: /gitlab 29 # relative_url_root: /gitlab
37 30
38 # Uncomment and customize if you can't use the default user to run GitLab (default: 'git') 31 # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
config/unicorn.rb.example
@@ -8,14 +8,8 @@ @@ -8,14 +8,8 @@
8 # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete 8 # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
9 # documentation. 9 # documentation.
10 10
11 -# Uncomment and customize the last line to run in a non-root path  
12 -# WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this.  
13 -# Note that four settings need to be changed for this to work.  
14 -# 1) In your application.rb file: config.relative_url_root = "/gitlab"  
15 -# 2) In your gitlab.yml file: relative_url_root: /gitlab  
16 -# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"  
17 -# 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab"  
18 -# To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production 11 +# WARNING: See config/application.rb under "Relative url support" for the list of
  12 +# other files that need to be changed for relative url support
19 # 13 #
20 # ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" 14 # ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
21 15
lib/support/nginx/gitlab
@@ -59,6 +59,9 @@ server { @@ -59,6 +59,9 @@ server {
59 } 59 }
60 60
61 # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression 61 # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
  62 + # WARNING: If you are using relative urls do remove the block below
  63 + # See config/application.rb under "Relative url support" for the list of
  64 + # other files that need to be changed for relative url support
62 location ~ ^/(assets)/ { 65 location ~ ^/(assets)/ {
63 root /home/git/gitlab/public; 66 root /home/git/gitlab/public;
64 gzip_static on; # to serve pre-gzipped version 67 gzip_static on; # to serve pre-gzipped version
@@ -67,4 +70,4 @@ server { @@ -67,4 +70,4 @@ server {
67 } 70 }
68 71
69 error_page 502 /502.html; 72 error_page 502 /502.html;
70 -}  
71 \ No newline at end of file 73 \ No newline at end of file
  74 +}