-
Notifications
You must be signed in to change notification settings - Fork 1
/
apache.conf
88 lines (65 loc) · 2.16 KB
/
apache.conf
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
# Unicode UTF-8
AddDefaultCharset utf-8
# Increase threads
# Note: 'a2query -M' shows the type (prefork/worker) which is in use
MaxRequestWorkers 256
# Avoid giving away unnecessary information about the webserver configuration
ServerSignature Off
ServerTokens ProductOnly
php_admin_value expose_php 0
# Tighten paths
AcceptPathInfo Off
# Enable gzip compression
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule filter_module modules/mod_filter.so
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
DeflateCompressionLevel 9
# Redirection host from HTTP -> HTTPS
<VirtualHost *:80>
ServerName www.cyipt.bike
DocumentRoot /var/www/html/
# Logging
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %T/%D" combined
CustomLog ${APACHE_LOG_DIR}/cyipt_http-access.log combined
ErrorLog ${APACHE_LOG_DIR}/cyipt_http-error.log
# Address variants
ServerAlias cyipt.bike
# Redirect all traffic to HTTPS
RedirectMatch Permanent ^/(?!.well-known)(.*)$ https://www.cyipt.bike/
</VirtualHost>
# HTTPS host, main site
<VirtualHost *:443>
ServerName www.cyipt.bike
DocumentRoot /var/www/cyipt
# Enable SSL
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/www.cyipt.bike/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.cyipt.bike/privkey.pem
# Logging
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %T/%D" combined
CustomLog ${APACHE_LOG_DIR}/cyipt-access.log combined
ErrorLog ${APACHE_LOG_DIR}/cyipt-error.log
# Address variants
ServerAlias cyipt.bike
RewriteEngine on
RewriteCond %{HTTP_HOST} !www.cyipt.bike$ [NC]
RewriteRule ^/(.*) https://www.cyipt.bike/$1 [L,R=301]
# Allow access
<Location />
Require all granted
</Location>
# Enable mod_rewrite directives
<Directory /var/www/cyipt/>
AllowOverride FileInfo
</Directory>
# Indexes
DirectoryIndex index.html index.php
<Location />
Options -Indexes
</Location>
# Enable PHP
AddType application/x-httpd-php .php
# Rapid cycleways
Alias /rapid /var/www/popupCycleways/v1
</VirtualHost>