feat: prepare staging domain proxy
This commit is contained in:
parent
51da6d8881
commit
e820a11668
|
|
@ -2,6 +2,9 @@
|
|||
# required values. Replace every credential before any public deployment.
|
||||
HTTP_PORT=4010
|
||||
MAILPIT_PORT=8027
|
||||
# Comma-separated proxy IP/CIDR values whose X-Forwarded-* headers Traefik
|
||||
# accepts. Keep loopback locally; set the exact VPN proxy address for staging.
|
||||
TRAEFIK_TRUSTED_IPS=127.0.0.1/32
|
||||
PHX_HOST=localhost
|
||||
PHX_SCHEME=http
|
||||
PHX_URL_PORT=4010
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ services:
|
|||
- --providers.docker=true
|
||||
- --providers.docker.exposedbydefault=false
|
||||
- --entrypoints.web.address=:80
|
||||
- --entrypoints.web.forwardedheaders.trustedips=${TRAEFIK_TRUSTED_IPS:-127.0.0.1/32}
|
||||
ports:
|
||||
- "${HTTP_PORT:-4010}:80"
|
||||
volumes:
|
||||
|
|
|
|||
44
deploy/nginx/README.md
Normal file
44
deploy/nginx/README.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Staging reverse proxy
|
||||
|
||||
`whoneedhelp.imalto.site.conf` is the HTTP vhost consumed by Certbot's Nginx
|
||||
installer on the VPN gateway. It forwards HTTP and LiveView WebSocket traffic
|
||||
to the workstation at `10.8.0.14:4010`.
|
||||
|
||||
The workstation's ignored `.env` must use:
|
||||
|
||||
```dotenv
|
||||
PHX_HOST=whoneedhelp.imalto.site
|
||||
PHX_SCHEME=https
|
||||
PHX_URL_PORT=443
|
||||
TRAEFIK_TRUSTED_IPS=10.8.0.1/32
|
||||
```
|
||||
|
||||
The last setting allows forwarded headers only from the observed VPN address of
|
||||
the gateway. Do not replace it with Traefik's insecure forwarded-header mode.
|
||||
|
||||
The checked server currently uses the standard Ubuntu Nginx/Certbot layout.
|
||||
After copying the vhost to `/home/simple/whoneedhelp.imalto.site.conf`, install
|
||||
and enable it with root privileges:
|
||||
|
||||
```bash
|
||||
sudo install -o root -g root -m 0644 \
|
||||
/home/simple/whoneedhelp.imalto.site.conf \
|
||||
/etc/nginx/sites-available/whoneedhelp.imalto.site
|
||||
sudo ln -s \
|
||||
/etc/nginx/sites-available/whoneedhelp.imalto.site \
|
||||
/etc/nginx/sites-enabled/whoneedhelp.imalto.site
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
sudo certbot --nginx --redirect -d whoneedhelp.imalto.site
|
||||
sudo nginx -t
|
||||
```
|
||||
|
||||
If validation fails before certificate issuance, remove only the new symlink
|
||||
and file, validate the previous configuration, and reload:
|
||||
|
||||
```bash
|
||||
sudo rm -f /etc/nginx/sites-enabled/whoneedhelp.imalto.site
|
||||
sudo rm -f /etc/nginx/sites-available/whoneedhelp.imalto.site
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
19
deploy/nginx/whoneedhelp.imalto.site.conf
Normal file
19
deploy/nginx/whoneedhelp.imalto.site.conf
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name whoneedhelp.imalto.site;
|
||||
|
||||
location / {
|
||||
proxy_pass http://10.8.0.14:4010;
|
||||
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;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
client_max_body_size 100M;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user