author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Thu, 02 May 2024 15:47:37 +0300 | |
changeset 34 | 68975e7d5237 |
parent 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=stat |
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> |
31
461eed8e7463
Activating Let's Encrypt webroot renewal for all my sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
21
diff
changeset
|
20 |
|
461eed8e7463
Activating Let's Encrypt webroot renewal for all my sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
21
diff
changeset
|
21 |
Alias "/.well-known/acme-challenge/" "/srv/www/letsencrypt/.well-known/acme-challenge/" |
461eed8e7463
Activating Let's Encrypt webroot renewal for all my sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
21
diff
changeset
|
22 |
<Directory "/srv/www/letsencrypt/"> |
461eed8e7463
Activating Let's Encrypt webroot renewal for all my sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
21
diff
changeset
|
23 |
Require all granted |
461eed8e7463
Activating Let's Encrypt webroot renewal for all my sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
21
diff
changeset
|
24 |
</Directory> |
11
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
25 |
</VirtualHost> |
21
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 |
<IfModule mod_ssl.c> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
28 |
<VirtualHost $d.defun.work:443> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
29 |
DocumentRoot /srv/www/$d |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
30 |
ServerName $d.defun.work |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
31 |
|
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
32 |
<Directory "/srv/www/$d/"> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
33 |
Require all granted |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
34 |
</Directory> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
35 |
|
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
36 |
SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
37 |
SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem |
34
68975e7d5237
Recreate Apache settings for Lets Encrypt SSL.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
31
diff
changeset
|
38 |
Include /srv/www/letsencrypt/apache-ssl-options.conf |
21
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
39 |
</VirtualHost> |
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
40 |
</IfModule> |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
41 |
EOF |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
42 |
|
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
43 |
a2ensite $d |
21
52f40bd9e114
Integrated Lets Encrypt into all sites.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
14
diff
changeset
|
44 |
service apache2 reload |