Use native nginx templating

pull/67/head
Peter Rauscher 2023-04-24 00:22:09 -04:00
parent de3873392d
commit f22bbfd21d
3 changed files with 20 additions and 26 deletions

View File

@ -20,16 +20,17 @@ services:
networks:
- nginx-passthrough
nginx:
build: ./nginx/
image: nginx:mainline-alpine
restart: always
env_file:
- .env
volumes:
- ./nginx:/etc/nginx/templates
- /etc/certbot/conf:/etc/letsencrypt
- /etc/certbot/www:/var/www/certbot
ports:
- 80:80
- 443:443
volumes:
- /etc/certbot/conf:/etc/letsencrypt
- /etc/certbot/www:/var/www/certbot
restart: always
networks:
- nginx-passthrough
certbot:

View File

@ -1,7 +0,0 @@
FROM nginx:mainline-alpine
COPY ./nginx.conf /etc/nginx/conf.d/
RUN sed -i 's/{API_PORT}/'"$API_PORT"'/g' /etc/nginx/conf.d/nginx.conf.template && \
sed -i 's/{DOMAIN}/'"$DOMAIN"'/g' /etc/nginx/conf.d/nginx.conf.template && \
mv /etc/nginx/conf.d/nginx.conf.template /etc/nginx/conf.d/nginx.conf

View File

@ -1,23 +1,23 @@
server {
listen 80;
server_name {DOMAIN} www.{DOMAIN};
return 301 https://{DOMAIN}$request_uri;
}
server {
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/{DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{DOMAIN}/privkey.pem;
server_name {DOMAIN} www.{DOMAIN};
location / {
proxy_pass http://api:{API_PORT}/;
}
server_name ${DOMAIN} www.${DOMAIN};
location ~ /.well-known/acme-challenge {
allow all;
root /var/www/certbot;
}
return 301 https://${DOMAIN}$request_uri;
}
server {
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem;
server_name ${DOMAIN} www.${DOMAIN};
location / {
proxy_pass http://api:${API_PORT}/;
}
}