Skip to content

Proxy

Nginx Proxy Server

Using Nginx proxy server can consolidate multiple http/https resouce into one place.
Here is the file structure of these backend services configure files:

/etc/nginx/http.d
├── 901_APan-MkDocs-live_s26-39.conf
├── 902_APan-MkDocs-static_s26-39.conf
├── 903_html-root_s26-39.conf
├── 904_PhotoPrism_s26-38.conf
└── default.conf
And all these 9??* are for different backend serving at different port. Here is one sample of it:
server {

    listen 901;
    error_page 502 503 504 = @backend_down;

    location / {
        proxy_pass http://192.168.100.45:8000;

        proxy_connect_timeout 3s;
        proxy_send_timeout    15s;
        proxy_read_timeout    15s;
        proxy_intercept_errors on;

        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;
    }

    location @backend_down {
        default_type text/html;
        return 503 '
<h3>APan MkDocs Live is Offline</h3>
<p>Backend: 192.168.100.45:8000   /   s26-39 at LG</p>
';
    }

}