route assets/ requests to the gitlab application when relative_url used

Fixes #531
Refer #521
This commit is contained in:
Sameer Naik 2015-12-09 21:13:51 +05:30
parent 0a1b523116
commit ae1706d01c
3 changed files with 4 additions and 7 deletions

View File

@ -65,7 +65,6 @@ server {
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
location {{GITLAB_RELATIVE_URL_ROOT}} {
# alias {{GITLAB_INSTALL_DIR}}/public;
## Serve static files from defined root folder.
## @gitlab is a named location for the upstream fallback, see below.
try_files $uri /index.html $uri.html @gitlab;
@ -195,8 +194,8 @@ server {
## WARNING: If you are using relative urls remove the block below
## See config/application.rb under "Relative url support" for the list of
## other files that need to be changed for relative url support
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}assets/(.*) {
alias {{GITLAB_INSTALL_DIR}}/public/assets/$1;
location ~ ^/(assets)/ {
root {{GITLAB_INSTALL_DIR}};
gzip_static on; # to serve pre-gzipped version
expires max;
add_header Cache-Control public;

View File

@ -113,7 +113,6 @@ server {
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
location {{GITLAB_RELATIVE_URL_ROOT}} {
# alias {{GITLAB_INSTALL_DIR}}/public;
## Serve static files from defined root folder.
## @gitlab is a named location for the upstream fallback, see below.
try_files $uri /index.html $uri.html @gitlab;
@ -245,8 +244,8 @@ server {
## WARNING: If you are using relative urls remove the block below
## See config/application.rb under "Relative url support" for the list of
## other files that need to be changed for relative url support
location ~ ^{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}assets/(.*) {
alias {{GITLAB_INSTALL_DIR}}/public/assets/$1;
location ~ ^/(assets)/ {
root {{GITLAB_INSTALL_DIR}};
gzip_static on; # to serve pre-gzipped version
expires max;
add_header Cache-Control public;

View File

@ -649,7 +649,6 @@ nginx_configure_gitlab_relative_url() {
echo "Configuring nginx::gitlab::relative_url..."
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT}}|'"${GITLAB_RELATIVE_URL_ROOT}"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|'"${GITLAB_RELATIVE_URL_ROOT}/"'|g' /etc/nginx/sites-enabled/gitlab
sed -i 's|# alias '"${GITLAB_INSTALL_DIR}"'/public|alias '"${GITLAB_INSTALL_DIR}"'/public|' /etc/nginx/sites-enabled/gitlab
else
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT}}|/|' /etc/nginx/sites-enabled/gitlab
sed -i 's|{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}}|/|g' /etc/nginx/sites-enabled/gitlab