diff --git a/assets/runtime/config/nginx/gitlab b/assets/runtime/config/nginx/gitlab index b2ff0d6a..316e061a 100644 --- a/assets/runtime/config/nginx/gitlab +++ b/assets/runtime/config/nginx/gitlab @@ -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; diff --git a/assets/runtime/config/nginx/gitlab-ssl b/assets/runtime/config/nginx/gitlab-ssl index a19a96b0..f4d6a2a0 100644 --- a/assets/runtime/config/nginx/gitlab-ssl +++ b/assets/runtime/config/nginx/gitlab-ssl @@ -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; diff --git a/assets/runtime/functions b/assets/runtime/functions index 6e19b0bf..15bd8ede 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -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