Modifying https_proxy docker container so that upstream host and port can be configured.

This commit is contained in:
Roland 2025-08-17 11:23:19 -06:00 • committed by lrnselfreliance
parent f09e9ffb2f
commit 7bc261a8a3
3 changed files with 13 additions and 3 deletions

View file

@ -7,6 +7,10 @@ RUN openssl req -new -x509 -nodes -key /cert.key -out /cert.crt -days 3650 \
-subj "/C=US/ST=State/L=City/O=Org/OU=WROLPi/CN=wrolpi.local"
RUN chmod 777 /cert.key /cert.crt
# Copy Nginx configuration
COPY docker/https_proxy/nginx.proxy.conf /etc/nginx/nginx.conf
# Apply docker-compose environment variables to config
ENV UPSTREAM_HOST=you-must-change-this-in-docker-compose
ENV UPSTREAM_PORT=80
COPY docker/https_proxy/nginx.proxy.conf.template /etc/nginx/nginx.conf
RUN envsubst < /etc/nginx/nginx.conf > /etc/nginx/nginx.conf
CMD ["nginx", "-g", "daemon off;"]

View file

@ -8,7 +8,7 @@ http {
ssl_certificate_key /cert.key;
location / {
proxy_pass http://localhost:80;
proxy_pass http://${UPSTREAM_HOST}:${UPSTREAM_PORT};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;