Skip to content

Commit b7a1cc2

Browse files
author
Aingeru
committed
nginx review
1 parent 968241e commit b7a1cc2

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apk update && apk upgrade && \
88
ENV WEB_ROOT_PATH=/var/www/certbot
99

1010
# Copiar las configuraciones de nginx
11-
COPY ./nginx/conf /etc/nginx/conf.d
11+
COPY ./nginx /etc/nginx
1212

1313
EXPOSE 80
1414

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
server {
22
listen 80;
33
listen [::]:80;
4-
5-
server_name DOMAIN; # Setted by start.sh
4+
5+
server_name DOMAIN; # Set by start.sh
66
server_tokens off;
77

8+
# Disable access log to reduce disk I/O
9+
access_log off;
10+
811
location / {
9-
return 200 'gangnam style!';
1012
add_header Content-Type text/plain;
13+
return 200 'gangnam style!';
1114
}
12-
15+
1316
location /.well-known/acme-challenge/ {
1417
root /var/www/certbot;
18+
try_files $uri =404;
1519
}
1620
}

start.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ fi
2121
if [ ! -d "${WEB_ROOT_PATH}" ]; then
2222
mkdir -p "${WEB_ROOT_PATH}"
2323
fi
24-
sudo systemctl enable nginx
25-
sudo systemctl start nginx
24+
25+
# Start Nginx service
26+
nginx
2627

2728
# Launch challenge for domain, Nginx must be running with Certbot configuration to resolve
2829
certbot certonly -n --webroot --webroot-path ${WEB_ROOT_PATH} -d ${DOMAIN} --agree-tos --email ${EMAIL}
2930

31+
# Stop Nginx service
32+
nginx -s stop
33+
3034
if [ -f /etc/letsencrypt/live/${DOMAIN}/privkey.pem ] && [ -f /etc/letsencrypt/live/${DOMAIN}/cert.pem ]; then
3135

3236
# Create PFX file from letsencrypt certificates resolved by Certbot, output on desired path that should be mapped with Docker volume

0 commit comments

Comments
 (0)