-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding ssl support w/certbot & let's encrypt
- Loading branch information
1 parent
280f39e
commit 2551f6f
Showing
5 changed files
with
124 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
HOST_PORT=8080 | ||
DOMAIN=localhost | ||
DB_NAME=boltium | ||
DB_USER=boltium | ||
DB_PASSWORD=secret | ||
DB_ROOT_PASSWORD=topsecret | ||
# ENABLE_SSL=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
server { | ||
listen 80; | ||
server_name ${DOMAIN}; | ||
|
||
root /var/www/html/public; | ||
index index.php index.html index.htm; | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
try_files $uri /index.php$is_args$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_pass php:9000; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name ${DOMAIN}; | ||
|
||
ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem; | ||
|
||
root /var/www/html/public; | ||
index index.php index.html index.htm; | ||
|
||
location / { | ||
try_files $uri /index.php$is_args$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_pass php:9000; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
DEFAULT_CONF="/etc/nginx/conf.d/default.conf" | ||
SSL_CONF="/etc/nginx/conf.d/ssl.conf" | ||
|
||
if [ "$ENABLE_SSL" = "1" ]; then | ||
echo "SSL habilitado, creando ssl.conf con el dominio." | ||
|
||
envsubst '$DOMAIN' < /etc/nginx/conf.d/ssl.conf.template > "$SSL_CONF" | ||
|
||
[ -f "$DEFAULT_CONF" ] && rm "$DEFAULT_CONF" | ||
else | ||
echo "SSL disabled, creating default.conf." | ||
envsubst '$DOMAIN' < /etc/nginx/conf.d/default.conf.template > "$DEFAULT_CONF" | ||
|
||
[ -f "$SSL_CONF" ] && rm "$SSL_CONF" | ||
fi | ||
|
||
nginx -g 'daemon off;' |