This repository has been archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-entrypoint.sh
executable file
·92 lines (69 loc) · 3.78 KB
/
docker-entrypoint.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
set -e
# Copy user defined configs from temp folder to existing.
if [ "$(ls -A /temp_configs_dir)" ]; then
cp -f -R /temp_configs_dir/* /etc/
fi
if [ "$USE_ONLY_CONFIGS" -eq "1" ]; then
echo $USE_ONLY_CONFIGS;
else
if [ -n "$KEEPALIVE_TIMEOUT" ]; then
sed -i 's@^ keepalive_timeout.*@'" keepalive_timeout ${KEEPALIVE_TIMEOUT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$FASTCGI_READ_TIMEOUT" ]; then
sed -i 's@^ fastcgi_read_timeout.*@'" fastcgi_read_timeout ${FASTCGI_READ_TIMEOUT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$LISTEN_PORT" ]; then
sed -i 's@^ listen 80;.*@'" listen ${LISTEN_PORT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$LISTEN_SSL_PORT" ]; then
sed -i 's@^ listen 443 ssl;.*@'" listen ${LISTEN_SSL_PORT} ssl;"'@' /etc/nginx/nginx.conf
fi
if [ -n "$SERVER_ROOT" ]; then
sed -i 's@^ root.*@'" root ${SERVER_ROOT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$SERVER_NAME" ]; then
sed -i 's@^ server_name.*@'" server_name ${SERVER_NAME};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$CLIENT_MAX_BODY_SIZE" ]; then
sed -i 's@^ client_max_body_size.*@'" client_max_body_size ${CLIENT_MAX_BODY_SIZE};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$PROXY_CONNECT_TIMEOUT" ]; then
sed -i 's@^ proxy_connect_timeout.*@'" proxy_connect_timeout ${PROXY_CONNECT_TIMEOUT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$PROXY_SEND_TIMEOUT" ]; then
sed -i 's@^ proxy_send_timeout.*@'" proxy_send_timeout ${PROXY_SEND_TIMEOUT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$PROXY_READ_TIMEOUT" ]; then
sed -i 's@^ proxy_read_timeout.*@'" proxy_read_timeout ${PROXY_READ_TIMEOUT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$SEND_TIMEOUT" ]; then
sed -i 's@^ send_timeout.*@'" send_timeout ${SEND_TIMEOUT};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$FASTCGI_BUFFERS" ]; then
sed -i 's@^ fastcgi_buffers.*@'" fastcgi_buffers ${FASTCGI_BUFFERS};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$FASTCGI_BUFFER_SIZE" ]; then
sed -i 's@^ fastcgi_buffer_size.*@'" fastcgi_buffer_size ${FASTCGI_BUFFER_SIZE};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$PROXY_BUFFER_SIZE" ]; then
sed -i 's@^ proxy_buffer_size.*@'" proxy_buffer_size ${PROXY_BUFFER_SIZE};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$PROXY_BUFFERS" ]; then
sed -i 's@^ proxy_buffers.*@'" proxy_buffers ${PROXY_BUFFERS};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$PROXY_BUSY_BUFFER_SIZE" ]; then
sed -i 's@^ proxy_busy_buffers_size.*@'" proxy_busy_buffers_size ${PROXY_BUSY_BUFFER_SIZE};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$PROXY_PASS" ]; then
sed -i 's@^ proxy_pass.*@'" proxy_pass ${PROXY_PASS};"'@' /etc/nginx/nginx.conf
fi
if [ -n "$OPENSSL_ARGS" ]; then
if [ -s /etc/nginx/ssl/nginx-selfsigned.custom.key ] || [ -s /etc/nginx/ssl/nginx-selfsigned.custom.key ]; then
openssl "$OPENSSL_ARGS" -keyout /etc/nginx/ssl/nginx-selfsigned.custom.key -out /etc/nginx/ssl/nginx-selfsigned.custom.crt
cp /etc/nginx/ssl/nginx-selfsigned.custom.key /etc/nginx/ssl/nginx-selfsigned.key
cp /etc/nginx/ssl/nginx-selfsigned.custom.crt /etc/nginx/ssl/nginx-selfsigned.crt
fi
fi
fi
nginx -g "daemon off;"