mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-18 13:58:25 +00:00
route assets/ requests to the gitlab application when relative_url used
Fixes #531 Refer #521
This commit is contained in:
parent
0a1b523116
commit
ae1706d01c
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user