Modify nginx config to let /uploads go through to unicorn.
This commit is contained in:
parent
6b0199ffc1
commit
eb210f4a18
2 changed files with 47 additions and 37 deletions
|
@ -1,5 +1,5 @@
|
||||||
## GitLab
|
## GitLab
|
||||||
## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller
|
## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller, DouweM
|
||||||
##
|
##
|
||||||
## Lines starting with two hashes (##) are comments with information.
|
## Lines starting with two hashes (##) are comments with information.
|
||||||
## Lines starting with one hash (#) are configuration parameters that can be uncommented.
|
## Lines starting with one hash (#) are configuration parameters that can be uncommented.
|
||||||
|
@ -50,15 +50,6 @@ server {
|
||||||
access_log /var/log/nginx/gitlab_access.log;
|
access_log /var/log/nginx/gitlab_access.log;
|
||||||
error_log /var/log/nginx/gitlab_error.log;
|
error_log /var/log/nginx/gitlab_error.log;
|
||||||
|
|
||||||
location / {
|
|
||||||
## Serve static files from defined root folder.
|
|
||||||
## @gitlab is a named location for the upstream fallback, see below.
|
|
||||||
try_files $uri $uri/index.html $uri.html @gitlab;
|
|
||||||
}
|
|
||||||
|
|
||||||
## If a file, which is not found in the root folder is requested,
|
|
||||||
## then the proxy passes the request to the upsteam (gitlab unicorn).
|
|
||||||
location @gitlab {
|
|
||||||
## If you use HTTPS make sure you disable gzip compression
|
## If you use HTTPS make sure you disable gzip compression
|
||||||
## to be safe against BREACH attack.
|
## to be safe against BREACH attack.
|
||||||
# gzip off;
|
# gzip off;
|
||||||
|
@ -75,6 +66,20 @@ server {
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_set_header X-Frame-Options SAMEORIGIN;
|
proxy_set_header X-Frame-Options SAMEORIGIN;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
## Serve static files from defined root folder.
|
||||||
|
## @gitlab is a named location for the upstream fallback, see below.
|
||||||
|
try_files $uri $uri/index.html $uri.html @gitlab;
|
||||||
|
}
|
||||||
|
|
||||||
|
## We route uploads through GitLab to prevent XSS and enforce access control.
|
||||||
|
location /uploads/ {
|
||||||
|
proxy_pass http://gitlab;
|
||||||
|
}
|
||||||
|
|
||||||
|
## If a file, which is not found in the root folder is requested,
|
||||||
|
## then the proxy passes the request to the upsteam (gitlab unicorn).
|
||||||
|
location @gitlab {
|
||||||
proxy_pass http://gitlab;
|
proxy_pass http://gitlab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +89,7 @@ server {
|
||||||
## See config/application.rb under "Relative url support" for the list of
|
## See config/application.rb under "Relative url support" for the list of
|
||||||
## other files that need to be changed for relative url support
|
## other files that need to be changed for relative url support
|
||||||
location ~ ^/(assets)/ {
|
location ~ ^/(assets)/ {
|
||||||
root /home/git/gitlab/public;
|
gzip on;
|
||||||
gzip_static on; # to serve pre-gzipped version
|
gzip_static on; # to serve pre-gzipped version
|
||||||
expires max;
|
expires max;
|
||||||
add_header Cache-Control public;
|
add_header Cache-Control public;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## GitLab
|
## GitLab
|
||||||
## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller
|
## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller, DouweM
|
||||||
##
|
##
|
||||||
## Modified from nginx http version
|
## Modified from nginx http version
|
||||||
## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
|
## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
|
||||||
|
@ -95,15 +95,6 @@ server {
|
||||||
access_log /var/log/nginx/gitlab_access.log;
|
access_log /var/log/nginx/gitlab_access.log;
|
||||||
error_log /var/log/nginx/gitlab_error.log;
|
error_log /var/log/nginx/gitlab_error.log;
|
||||||
|
|
||||||
location / {
|
|
||||||
## Serve static files from defined root folder.
|
|
||||||
## @gitlab is a named location for the upstream fallback, see below.
|
|
||||||
try_files $uri $uri/index.html $uri.html @gitlab;
|
|
||||||
}
|
|
||||||
|
|
||||||
## If a file, which is not found in the root folder is requested,
|
|
||||||
## then the proxy passes the request to the upsteam (gitlab unicorn).
|
|
||||||
location @gitlab {
|
|
||||||
## If you use HTTPS make sure you disable gzip compression
|
## If you use HTTPS make sure you disable gzip compression
|
||||||
## to be safe against BREACH attack.
|
## to be safe against BREACH attack.
|
||||||
gzip off;
|
gzip off;
|
||||||
|
@ -121,6 +112,20 @@ server {
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_set_header X-Frame-Options SAMEORIGIN;
|
proxy_set_header X-Frame-Options SAMEORIGIN;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
## Serve static files from defined root folder.
|
||||||
|
## @gitlab is a named location for the upstream fallback, see below.
|
||||||
|
try_files $uri $uri/index.html $uri.html @gitlab;
|
||||||
|
}
|
||||||
|
|
||||||
|
## We route uploads through GitLab to prevent XSS and enforce access control.
|
||||||
|
location /uploads/ {
|
||||||
|
proxy_pass http://gitlab;
|
||||||
|
}
|
||||||
|
|
||||||
|
## If a file, which is not found in the root folder is requested,
|
||||||
|
## then the proxy passes the request to the upsteam (gitlab unicorn).
|
||||||
|
location @gitlab {
|
||||||
proxy_pass http://gitlab;
|
proxy_pass http://gitlab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +135,7 @@ server {
|
||||||
## See config/application.rb under "Relative url support" for the list of
|
## See config/application.rb under "Relative url support" for the list of
|
||||||
## other files that need to be changed for relative url support
|
## other files that need to be changed for relative url support
|
||||||
location ~ ^/(assets)/ {
|
location ~ ^/(assets)/ {
|
||||||
root /home/git/gitlab/public;
|
gzip on;
|
||||||
gzip_static on; # to serve pre-gzipped version
|
gzip_static on; # to serve pre-gzipped version
|
||||||
expires max;
|
expires max;
|
||||||
add_header Cache-Control public;
|
add_header Cache-Control public;
|
||||||
|
|
Loading…
Reference in a new issue