-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
85 lines (73 loc) · 2.33 KB
/
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
#!/bin/bash
set -e
if [ -f /etc/apache2/sites-available/vhost-website.conf ]; then
rm /etc/apache2/sites-available/vhost-website.conf
fi
if [ -z "$WEBSITE_HOST" ]; then
WEBSITE_HOST="website.docker"
fi
if [ "$SYMFONY_VHOST_COMPLIANT" == "yes" ]; then
SUFFIX="/web"
fi
if [ -f /etc/ssmtp/revaliases ]; then
rm /etc/ssmtp/revaliases
fi
if [ -f /etc/ssmtp/ssmtp.conf ]; then
rm /etc/ssmtp/ssmtp.conf
fi
cat <<EOF >> /etc/ssmtp/revaliases
root:$SMTP_USER:$SMTP_HOST
EOF
cat <<EOF >> /etc/ssmtp/ssmtp.conf
root=postmaster
mailhub=$SMTP_HOST
AuthUser=$SMTP_USER
AuthPass=$SMTP_PASSWORD
FromLineOverride=YES
#Debug=YES
hostname=docker.acti
EOF
cat <<EOF >> /etc/apache2/sites-available/vhost-website.conf
<VirtualHost *:80>
ServerName $WEBSITE_HOST
ServerAlias *.$WEBSITE_HOST
ServerAdmin webmaster@localhost
DocumentRoot /var/www/website$SUFFIX
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/website$SUFFIX>
Require all granted
Options -Indexes +FollowSymLinks -MultiViews
Order allow,deny
allow from all
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName $WEBSITE_HOST
ServerAlias *.$WEBSITE_HOST
ServerAdmin webmaster@localhost
DocumentRoot /var/www/website$SUFFIX
ErrorLog ${APACHE_LOG_DIR}/error-ssl.log
CustomLog ${APACHE_LOG_DIR}/access-ssl.log combined
<Directory /var/www/website$SUFFIX>
Require all granted
Options -Indexes +FollowSymLinks -MultiViews
Order allow,deny
allow from all
AllowOverride All
</Directory>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/ssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/ssl.key
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
RequestHeader set X-Forwarded-Proto "https"
</VirtualHost>
EOF
#if [ "$CERTIFICAT_CNAME" != "" ]; then
# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=FR/ST=c2is/L=Lyon/O=c2is/CN=$CERTIFICAT_CNAME" -keyout /etc/apache2/ssl/ssl.key -out /etc/apache2/ssl/ssl.crt
#fi
exec "$@"