-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspcodex-le-ssl.conf
46 lines (34 loc) · 1.4 KB
/
spcodex-le-ssl.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
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www/
ServerName spcodex.wiki
SetEnvIfNoCase User-Agent "(Amazonbot|PetalBot)" bad_bot=yes
#SetEnvIf Remote_Addr ^170\.64\.173\.31 bad_bot=yes
SetEnvIf Request_URI "^/.git/*" bad_bot=yes
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
AllowEncodedSlashes NoDecode
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Deny from env=bad_bot
</Directory>
<Directory /var/www/images/>
Header always set X-Content-Type-Options nosniff
</Directory>
RewriteEngine On
ErrorDocument 403 "Either this page is not accessible, or your access to SPCodex has been blocked due to apparent abuse or disruptive automation. For inquiries, please contact [email protected]"
# Redirect legacy /wiki/ route
RewriteRule "^/wiki(/.+)?$" "$1" [R,L]
# UrlShortener
RewriteRule ^r/(.*)$ /Special:UrlRedirector/$1 [PT]
RewriteCond %{REQUEST_URI} !^/rest\.php
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]
SSLCertificateFile /etc/letsencrypt/live/spcodex.wiki/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/spcodex.wiki/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>