Change NGINX pages configs to account for the Pages daemon
This commit is contained in:
parent
d5ccea0286
commit
50bbc326a4
2 changed files with 15 additions and 19 deletions
|
@ -8,20 +8,18 @@ server {
|
||||||
|
|
||||||
## Replace this with something like pages.gitlab.com
|
## Replace this with something like pages.gitlab.com
|
||||||
server_name ~^(?<group>.*)\.YOUR_GITLAB_PAGES\.DOMAIN$;
|
server_name ~^(?<group>.*)\.YOUR_GITLAB_PAGES\.DOMAIN$;
|
||||||
root /home/git/gitlab/shared/pages/${group};
|
|
||||||
|
|
||||||
## Individual nginx logs for GitLab pages
|
## Individual nginx logs for GitLab pages
|
||||||
access_log /var/log/nginx/gitlab_pages_access.log;
|
access_log /var/log/nginx/gitlab_pages_access.log;
|
||||||
error_log /var/log/nginx/gitlab_pages_error.log;
|
error_log /var/log/nginx/gitlab_pages_error.log;
|
||||||
|
|
||||||
# 1. Try to get /path/ from shared/pages/${group}/${path}/public/
|
location / {
|
||||||
# 2. Try to get / from shared/pages/${group}/${host}/public/
|
proxy_set_header Host $http_host;
|
||||||
location ~ ^/([^/]*)(/.*)?$ {
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
try_files "/$1/public$2"
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
"/$1/public$2/index.html"
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
"/${host}/public/${uri}"
|
# The same address as passed to GitLab Pages: `-listen-proxy`
|
||||||
"/${host}/public/${uri}/index.html"
|
proxy_pass http://localhost:8282/;
|
||||||
=404;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Define custom error pages
|
# Define custom error pages
|
||||||
|
|
|
@ -23,12 +23,11 @@ server {
|
||||||
## Pages serving host
|
## Pages serving host
|
||||||
server {
|
server {
|
||||||
listen 0.0.0.0:443 ssl;
|
listen 0.0.0.0:443 ssl;
|
||||||
listen [::]:443 ipv6only=on ssl;
|
listen [::]:443 ipv6only=on ssl http2;
|
||||||
|
|
||||||
## Replace this with something like pages.gitlab.com
|
## Replace this with something like pages.gitlab.com
|
||||||
server_name ~^(?<group>.*)\.YOUR_GITLAB_PAGES\.DOMAIN$;
|
server_name ~^(?<group>.*)\.YOUR_GITLAB_PAGES\.DOMAIN$;
|
||||||
server_tokens off; ## Don't show the nginx version number, a security best practice
|
server_tokens off; ## Don't show the nginx version number, a security best practice
|
||||||
root /home/git/gitlab/shared/pages/${group};
|
|
||||||
|
|
||||||
## Strong SSL Security
|
## Strong SSL Security
|
||||||
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
|
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
|
||||||
|
@ -63,14 +62,13 @@ server {
|
||||||
access_log /var/log/nginx/gitlab_pages_access.log;
|
access_log /var/log/nginx/gitlab_pages_access.log;
|
||||||
error_log /var/log/nginx/gitlab_pages_error.log;
|
error_log /var/log/nginx/gitlab_pages_error.log;
|
||||||
|
|
||||||
# 1. Try to get /path/ from shared/pages/${group}/${path}/public/
|
location / {
|
||||||
# 2. Try to get / from shared/pages/${group}/${host}/public/
|
proxy_set_header Host $http_host;
|
||||||
location ~ ^/([^/]*)(/.*)?$ {
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
try_files "/$1/public$2"
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
"/$1/public$2/index.html"
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
"/${host}/public/${uri}"
|
# The same address as passed to GitLab Pages: `-listen-proxy`
|
||||||
"/${host}/public/${uri}/index.html"
|
proxy_pass http://localhost:8282/;
|
||||||
=404;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Define custom error pages
|
# Define custom error pages
|
||||||
|
|
Loading…
Reference in a new issue