websoft9/docker/w9nginxproxymanager/initproxy.conf
2023-06-01 11:06:07 +08:00

134 lines
4.9 KiB
Plaintext

# ------------------------------------------------------------
# domain.com
# ------------------------------------------------------------
server {
set $forward_scheme http;
set $server "172.17.0.1";
set $port 9000;
listen 80;
listen [::]:80;
server_name domain.com;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
access_log /data/logs/proxy-host-2_access.log proxy;
error_log /data/logs/proxy-host-2_error.log warn;
location /AppManage/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://websoft9-appmanage:5000/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
auth_basic "Protected Area";
auth_basic_user_file /data/nginx/proxy_host/.htpasswd;
}
location /portainer/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://websoft9-portainer:9000/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
}
location /nginxproxymanager/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://websoft9-nginxproxymanager:81;
rewrite ^/nginxproxymanager/?(.*)$ /$1 break;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;
proxy_set_header Accept-Encoding "";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/nginxproxymanager/';
sub_filter 'src="/' 'src="/nginxproxymanager/';
sub_filter '/api' '/nginxproxymanager/api';
sub_filter '/assets' '/nginxproxymanager/assets';
sub_filter '/js/' '/nginxproxymanager/js/';
# script changes
sub_filter 'r.p="/' 'r.p="/nginxproxymanager/';
sub_filter '"/login' '"/nginxproxymanager/login';
sub_filter 'case"/logout"' 'case"/nginxproxymanager/logout"';
sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"';
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})';
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;
}
location /kopia {
set $auth $cookie_auth;
if ($auth = "") {
set $auth $arg_id;
add_header Set-Cookie "auth=$auth; Path=/; HttpOnly";
}
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Prefix /kopia;
proxy_pass http://websoft9-kopia:51515/;
rewrite ^/kopia/(.*)$ /$1 break;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_cache_bypass $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;
proxy_set_header Accept-Encoding "";
proxy_set_header Authorization "Basic $auth";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes
sub_filter 'href="/' 'href="/kopia/';
sub_filter 'src="/' 'src="/kopia/';
sub_filter '/api' '/kopia/api';
sub_filter '/assets' '/kopia/assets';
sub_filter '/static/' '/kopia/static/';
# script changes
sub_filter 'e.runningTaskCount;return(0,k.jsx)(Qr,{' 'e.runningTaskCount;return(0,k.jsx)(Qr,{basename: "/kopia",';
sub_filter 'window.location.replace("/' 'window.location.replace("/kopia/';
sub_filter '"/kopia-flat.svg"' '"/kopia/kopia-flat.svg"';
sub_filter 'href:"/"' 'href:"/kopia/"';
sub_filter 'href:"/snapshots/new"' 'href:"/kopia/snapshots/new"';
sub_filter_types text/css text/javascript application/javascript;
sub_filter_once off;
}
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
# Proxy!
include conf.d/include/proxy.conf;
}
# Custom
include /data/nginx/custom/server_proxy[.]conf;
}