-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
48 lines (40 loc) · 1.21 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# Load the environment variables from the .env file.
. ./.env
# Ensure the Nginx configuration directory exists.
if [ ! -d ./data/etc/nginx/conf.d/ ]; then
mkdir -p ./data/etc/nginx/conf.d/
fi
# Loop over the domains.
for domain in $DOMAINS; do
# Generate the Nginx configuration for the current domain.
echo "
server {
listen 80;
server_name $domain;
server_tokens off;
http2 on;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$domain$request_uri;
}
}
server {
listen 443 ssl;
server_name $domain;
server_tokens off;
http2 on;
ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
include /etc/nginx/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://http://http://backend_web:8081;
# proxy_set_header Host $http_host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}" > ./data/etc/nginx/conf.d/$domain.conf.template
done