-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlibrivox.org.conf
102 lines (85 loc) · 4.08 KB
/
librivox.org.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<VirtualHost *:443>
ServerName librivox.org
ServerAlias www.librivox.org
DocumentRoot /librivox/www/librivox.org/catalog/public_html
<Directory /librivox/www/librivox.org/catalog/public_html>
AllowOverride none
Require all granted
</Directory>
<Directory /librivox/www/librivox.org/wordpress>
AllowOverride none
Require all granted
</Directory>
<Directory /librivox/www/librivox.org/wordpress/wp-content/uploads>
<Files ?*>
SetHandler default-handler
</Files>
</Directory>
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/librivox.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/librivox.org/privkey.pem
RewriteEngine on
# We can't use Alias for /uploads and /librivox-validator-books since
# there's a catch-all RewriteRule
RewriteRule ^/uploads(.*)$ /librivox/shared/uploads/uploads$1 [L]
RewriteRule ^/librivox-validator-books(.*)$ /librivox/shared/librivox-validator-books$1 [L]
<Directory /librivox/shared/uploads/uploads>
Options Indexes Multiviews
AllowOverride None
Require all granted
<Files ?*>
SetHandler default-handler
</Files>
</Directory>
<Directory /librivox/shared/librivox-validator-books>
Options Indexes Multiviews
AllowOverride None
Require all granted
<Files ?*>
SetHandler default-handler
</Files>
</Directory>
# Old /newcatalog URL needs to be redirected
RewriteCond %{REQUEST_URI} ^/newcatalog
RewriteRule ^.*$ https://librivox.org/search
# Old /forum URL needs to be redirected
RewriteCond %{REQUEST_URI} ^/forum(.*)$
RewriteRule ^.*$ https://forum.librivox.org%1?
# Redirect reader pages
RewriteCond %{REQUEST_URI} ^/newcatalog/people_public.php$
RewriteCond %{QUERY_STRING} peopleid=(.+)
RewriteRule ^.*$ https://librivox.org/reader/%1?
# Wordpress URLs
RewriteRule ^/(index.php)?$ /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/[0-9]{4}/[0-9]{2} /librivox/www/librivox.org/wordpress/index.php [L]
# The next one is tricky. The catalog needs /author/<digits>, as well as
# /author/get_results. WordPress needs /author/<letters>/ as well as
# /author/<letters>/page/<number> for pagination. The following is the best
# I have so far. Let's hope there's never a purely numeric username in
# WordPress.
RewriteRule ^/author/[a-zA-Z]+/ /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/category /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/comments/feed /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/donate-to-librivox /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/feed /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/pages /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/podcast.xml /librivox/www/librivox.org/wordpress/podcast.xml [L]
RewriteRule ^/wp-json /librivox/www/librivox.org/wordpress/index.php [L]
RewriteRule ^/(wp-.*) /librivox/www/librivox.org/wordpress/$1 [L]
# For Let's Encrypt's certbot
RewriteRule ^/(.well-known.*) /librivox/www/librivox.org/wordpress/$1 [L]
# For Google verification
RewriteRule ^/(google.*html)$ /librivox/www/librivox.org/wordpress/$1 [L]
# Everything else is the catalog
RewriteCond /librivox/www/librivox.org/catalog/public_html%{REQUEST_URI} !-f
RewriteCond /librivox/www/librivox.org/catalog/public_html%{REQUEST_URI} !-d
RewriteRule ^/(.*)$ /index.php?/$1 [PT]
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000/"
</FilesMatch>
</VirtualHost>
<VirtualHost *:80>
ServerName librivox.org
ServerAlias www.librivox.org
Redirect permanent / https://librivox.org/
</VirtualHost>