author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 31 Jul 2023 00:29:30 +0300 | |
changeset 29 | 74c62c0d1f64 |
parent 21 | 52f40bd9e114 |
child 31 | 461eed8e7463 |
permissions | -rw-r--r-- |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
#!/bin/bash |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
|
11
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
3 |
set -x |
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
4 |
|
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
5 |
# To meet uploading requirements. |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
apt install rsync |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
|
14
719ced1ac5c3
Added other sites to Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
8 |
d=cooking |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
mkdir -p /srv/www/$d |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
chown user:user /srv/www/$d |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
|
12
26943e31cae5
Removed numerical prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
11
diff
changeset
|
12 |
cat <<EOF >/etc/apache2/sites-available/$d.conf |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
<VirtualHost $d.defun.work:*> |
21
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
14 |
DocumentRoot /srv/www/$d |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
15 |
ServerName $d.defun.work |
13
7ed40cd96e3a
Possible fix for: AH01630: client denied by server configuration.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
16 |
|
7ed40cd96e3a
Possible fix for: AH01630: client denied by server configuration.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
17 |
<Directory "/srv/www/$d/"> |
7ed40cd96e3a
Possible fix for: AH01630: client denied by server configuration.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
18 |
Require all granted |
7ed40cd96e3a
Possible fix for: AH01630: client denied by server configuration.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
19 |
</Directory> |
11
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
20 |
</VirtualHost> |
21
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
21 |
|
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
22 |
<IfModule mod_ssl.c> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
23 |
<VirtualHost $d.defun.work:443> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
24 |
DocumentRoot /srv/www/$d |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
25 |
ServerName $d.defun.work |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
26 |
|
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
27 |
<Directory "/srv/www/$d/"> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
28 |
Require all granted |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
29 |
</Directory> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
30 |
|
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
31 |
SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
32 |
SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
33 |
Include /etc/letsencrypt/options-ssl-apache.conf |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
34 |
</VirtualHost> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
35 |
</IfModule> |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
36 |
EOF |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
37 |
|
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
38 |
a2ensite $d |
21
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
39 |
service apache2 reload |