fold-stack/nginx/dev/default.conf-old6

47 lines
1.5 KiB
Text

server {
listen 80;
# Default root redirect to Ghost
location / {
return 302 /ghost/;
}
# Proxy for Ghost CMS at /ghost/
location /ghost/ {
proxy_pass http://ghost_dev:2368/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Rewrite static asset paths for subpath
sub_filter 'href="/' 'href="/ghost/';
sub_filter 'src="/' 'src="/ghost/';
sub_filter_once off;
sub_filter_types text/html text/css application/javascript;
# Required to allow sub_filter to work
proxy_set_header Accept-Encoding "";
}
# Proxy for Forgejo at /forgejo/
location /forgejo/ {
# Rewrite URL path to remove /forgejo when passed to backend
rewrite ^/forgejo(/.*)$ $1 break;
proxy_pass http://forgejo_dev:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Rewrite asset paths inside HTML/JS/CSS
sub_filter 'href="/' 'href="/forgejo/';
sub_filter 'src="/' 'src="/forgejo/';
sub_filter_once off;
sub_filter_types text/html text/css application/javascript;
# Required to allow sub_filter to work
proxy_set_header Accept-Encoding "";
}
}