zapashcanon 4 months ago
parent
commit
ee40384a8b
Signed by: zapashcanon <leo@ndrs.fr> GPG Key ID: 8981C3C62D1D28F1
3 changed files with 56 additions and 64 deletions
  1. 3
    7
      scripts/install.sh
  2. 0
    41
      www.zapashcanon.fr-le-ssl.conf
  3. 53
    16
      www.zapashcanon.fr.conf

+ 3
- 7
scripts/install.sh View File

@@ -5,20 +5,16 @@ set -eu
5 5
 ( cd "$(dirname "$0")/../"
6 6
 
7 7
   domain=zapashcanon.fr
8
-  subdomain=www.${domain}
9 8
 
10
-  sudo cp ${subdomain}.conf /etc/apache2/sites-available/${subdomain}.conf
11
-  sudo cp ${subdomain}-le-ssl.conf /etc/apache2/sites-available/${subdomain}-le-ssl.conf
9
+  sudo cp ./*.conf /etc/apache2/sites-available/
12 10
   sudo mkdir -p /var/www/${domain}/
13 11
   sudo cp -r ./www/ /var/www/${domain}/
14 12
 
15 13
   cd /var/www/${domain}/www/var
16 14
   sudo rm -rf cache logs sessions
17 15
   sudo mkdir cache logs sessions
18
-  sudo chown -R www-data:www-data cache
19
-  sudo chown -R www-data:www-data sessions
20
-  sudo chown -R www-data:www-data logs
16
+  sudo chown -R www-data:www-data cache sessions logs
21 17
 
22
-  sudo systemctl reload apache2
18
+  sudo service apache2 restart
23 19
   echo "Installed !"
24 20
 )

+ 0
- 41
www.zapashcanon.fr-le-ssl.conf View File

@@ -1,41 +0,0 @@
1
-<IfModule mod_ssl.c>
2
-<VirtualHost *:443>
3
-
4
-	ServerName www.zapashcanon.fr
5
-	ServerAdmin leo@ndrs.fr
6
-	ServerAlias zapashcanon.fr
7
-
8
-	DocumentRoot "/var/www/zapashcanon.fr/www/web"
9
-	<Directory /var/www/zapashcanon.fr/www/web>
10
-		AllowOverride All
11
-		Order Allow,Deny
12
-		Allow from All
13
-	</Directory>
14
-
15
-	ErrorLog /var/log/apache2/zapashcanon.fr_error.log
16
-	CustomLog /var/log/apache2/zapashcanon.fr_access.log combined
17
-
18
-	Protocols h2 http/1.1
19
-
20
-	Include /etc/letsencrypt/options-ssl-apache.conf
21
-	SSLCertificateFile /etc/letsencrypt/live/www.zapashcanon.fr/fullchain.pem
22
-	SSLCertificateKeyFile /etc/letsencrypt/live/www.zapashcanon.fr/privkey.pem
23
-
24
-	<IfModule mod_expires.c>
25
-		ExpiresActive On
26
-		ExpiresByType image/jpg "access plus 1 year"
27
-		ExpiresByType image/jpeg "access plus 1 year"
28
-		ExpiresByType image/gif "access plus 1 year"
29
-		ExpiresByType image/png "access plus 1 year"
30
-		ExpiresByType text/css "access plus 1 month"
31
-		ExpiresByType application/pdf "access plus 1 month"
32
-		ExpiresByType text/x-javascript "access plus 1 month"
33
-		ExpiresByType application/javascript "access plus 1 month"
34
-		ExpiresByType application/x-shockwave-flash "access plus 1 month"
35
-		ExpiresByType image/x-icon "access plus 1 year"
36
-		ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
37
-		ExpiresDefault "access plus 2 days"
38
-	</IfModule>
39
-
40
-</VirtualHost>
41
-</IfModule>

+ 53
- 16
www.zapashcanon.fr.conf View File

@@ -1,23 +1,60 @@
1
+Define short_name www
2
+Define server_name ${short_name}.zapashcanon.fr
3
+Define admin_mail leo@ndrs.fr
4
+Define cert_name ${server_name}
5
+Define cert_dir /etc/letsencrypt/live
6
+Define log_dir /var/log/apache2
7
+Define log_file ${log_dir}/${short_name}
8
+Define error_log_file ${log_file}.error.log
9
+Define access_log_file ${log_file}.access.log
10
+Define doc_root /var/www/zapashcanon.fr/www/web
11
+
1 12
 <VirtualHost *:80>
2 13
 
3
-	ServerName www.zapashcanon.fr
4
-	ServerAdmin leo@ndrs.fr
5
-	ServerAlias zapashcanon.fr
14
+  ServerName ${server_name}
15
+  ServerAdmin ${admin_mail}
16
+  ServerAlias zapashcanon.fr
17
+
18
+  DocumentRoot ${doc_root}
19
+  <Directory ${doc_root}>
20
+    AllowOverride All
21
+    Order Allow,Deny
22
+    Allow from All
23
+  </Directory>
24
+
25
+  ErrorLog ${error_log_file}
26
+  CustomLog ${access_log_file} combined
27
+
28
+  Protocols h2c http/1.1
29
+
30
+  RewriteEngine on
31
+  RewriteCond %{SERVER_NAME} =${server_name}
32
+  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
33
+
34
+</VirtualHost>
35
+
36
+<IfModule mod_ssl.c>
37
+<VirtualHost *:443>
38
+
39
+  ServerName ${server_name}
40
+  ServerAdmin ${admin_mail}
41
+  ServerAlias zapashcanon.fr
42
+
43
+  DocumentRoot ${doc_root}
44
+  <Directory ${doc_root}>
45
+    AllowOverride All
46
+    Order Allow,Deny
47
+    Allow from All
48
+  </Directory>
6 49
 
7
-	DocumentRoot "/var/www/zapashcanon.fr/www/web"
8
-	<Directory /var/www/zapashcanon.fr/www/web>
9
-		AllowOverride All
10
-		Order Allow,Deny
11
-		Allow from All
12
-	</Directory>
50
+  ErrorLog ${error_log_file}
51
+  CustomLog ${access_log_file} combined
13 52
 
14
-	ErrorLog /var/log/apache2/zapashcanon.fr_error.log
15
-	CustomLog /var/log/apache2/zapashcanon.fr_access.log combined
53
+  Protocols h2 http/1.1
16 54
 
17
-	Protocols h2c http/1.1
55
+  SSLCertificateFile ${cert_dir}/${cert_name}/fullchain.pem
56
+  SSLCertificateKeyFile ${cert_dir}/${cert_name}/privkey.pem
57
+  Include /etc/letsencrypt/options-ssl-apache.conf
18 58
 
19
-	RewriteEngine on
20
-	RewriteCond %{SERVER_NAME} =zapashcanon.fr [OR]
21
-	RewriteCond %{SERVER_NAME} =www.zapashcanon.fr
22
-	RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
23 59
 </VirtualHost>
60
+</IfModule>

Loading…
Cancel
Save