-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsite.example.conf
115 lines (98 loc) · 4.87 KB
/
site.example.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
103
104
105
106
107
108
109
110
111
112
113
114
115
# This is a sample configuration of a Apache2 virtual host running the NNTP forum.
# It is configured to run on `news.example.com` and that the files are in
# `/srv/sites/news.example.com`. You need to modify these values corresponding to
# your setup.
<VirtualHost *:80>
ServerName news.example.com
DocumentRoot /srv/sites/news.example.com/public
LogLevel warn
ErrorLog /srv/sites/news.example.com/logs/site-error.log
CustomLog /srv/sites/news.example.com/logs/site-access.log combined
# Access configuration for the NNTP forum. By default we use the HTTP
# authentication to get the login data for the NNTP server. This works as
# long as this Apache2 virtual host and your NNTP server use the same
# authentication backend (e.g. LDAP).
<Directory /srv/sites/news.example.com/public>
# Accept either host authentication or HTTP authentication and
# set host authentication to deny by default (it's only used to
# clear access to show actions later on without a login).
Satisfy Any
Order Allow,Deny
Deny from all
# Protect all application actions with a login by default. This login
# is then picked up in include/config.php and use as NNTP login, too.
AuthType Basic
AuthName "Please log into your newsgroup account"
AuthBasicProvider ldap
AuthLDAPURL your-ldap-url
Require valid-user
</Directory>
# Open up files necessary for the "login required" error page
<Location /app/unauthorized.php>
Allow from all
</Location>
<Location /styles/*>
Allow from all
</Location>
# Show nice error pages that uses the same layout as the PHP pages
ErrorDocument 401 /app/errors/unauthorized.php
ErrorDocument 403 /app/errors/forbidden.php
ErrorDocument 404 /app/errors/not_found.php
# Disable PHP magic quotes, we do the magic by ourselfs…
php_flag magic_quotes_gpc Off
php_flag short_open_tag On
# Rewrite the nice URLs to the internal app URLs
RewriteEngine on
# Intercept typical files that browsers asked for to stop the server to
# look for newsgroups with that name
# /favicon.ico
RewriteRule /favicon.ico - [gone,last]
# /robots.txt
RewriteRule /robots.txt - [gone,last]
# Subscriptions:
# GET /your/subscriptions → /app/subscriptions.php
RewriteCond %{REQUEST_METHOD} GET|HEAD
RewriteRule ^/your/subscriptions$ /app/subscriptions.php [last,qsappend]
# POST /your/subscriptions → /app/subscriptions.php
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^/your/subscriptions$ /app/subscriptions.php [last,qsappend]
# DELETE /your/subscriptions/<lbaqd7$kpu$1@example.com> → /app/subscriptions.php?id=<lbaqd7$kpu$1@example.com>
RewriteCond %{REQUEST_METHOD} DELETE
RewriteRule ^/your/subscriptions/([^/]+)$ /app/subscriptions.php?id=$1 [last,qsappend,B]
# Newsfeeds:
# GET /offiziell.xml → /app/newsfeed.php?id=offiziell
RewriteRule ^/([^\./]+).xml$ /app/newsfeed.php?name=$1 [last,qsappend,B]
# Message ID to group URL lookup (when users klick on links in the mail notifications):
# GET /lbrbml$nph$1@news.hdm-stuttgart.de → /app/message_id_lookup.php?id=lbrbml$nph$1@news.hdm-stuttgart.de
RewriteCond %{REQUEST_METHOD} GET|HEAD
RewriteRule ^/([^@]+@[^/]+)$ /app/message_id_lookup.php?id=$1 [last,qsappend,B]
# Newsgroups:
# GET / → /app/newsgroups.php
RewriteCond %{REQUEST_METHOD} GET|HEAD
RewriteRule ^/$ /app/newsgroups.php [last,qsappend]
# Topics:
# GET /hdm.mi.allgemein → /app/topics.php?newsgroup=hdm.mi.allgemein
RewriteCond %{REQUEST_METHOD} GET|HEAD
RewriteRule ^/([^/]+)$ /app/topics.php?newsgroup=$1 [last,qsappend,B]
# POST /hdm.mi.allgemein → /app/message_create.php?newsgroup=hdm.mi.allgemein
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^/([^/]+)$ /app/messages/create.php?newsgroup=$1 [last,qsappend,B]
# Messages:
# GET /hdm.mi.allgemein/1820 → /app/messages/index.php?newsgroup=hdm.mi.allgemein&number=1820
RewriteCond %{REQUEST_METHOD} GET|HEAD
RewriteRule ^/([^/]+)/(\d+)$ /app/messages/index.php?newsgroup=$1&number=$2 [last,qsappend,B]
# POST /hdm.mi.allgemein/1820 → /app/messages/create.php?newsgroup=hdm.mi.allgemein&number=1820
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^/([^/]+)/(\d+)$ /app/messages/create.php?newsgroup=$1&number=$2 [last,qsappend,B]
# DELETE /hdm.mi.allgemein/1820 → /app/messages/destroy.php?newsgroup=hdm.mi.allgemein&number=1820
RewriteCond %{REQUEST_METHOD} DELETE
RewriteRule ^/([^/]+)/(\d+)$ /app/messages/destroy.php?newsgroup=$1&number=$2 [last,qsappend,B]
# Attachments:
# GET /hdm.mi.allgemein/1821/image.svg → /app/attachment.php?newsgroup=hdm.mi.allgemein&number=1820&attachment=image.svg
RewriteCond %{REQUEST_METHOD} GET|HEAD
RewriteRule ^/([^/]+)/(\d+)/([^/]+)$ /app/attachment.php?newsgroup=$1&number=$2&attachment=$3 [last,qsappend,B]
# JS locales:
# GET /scripts/locale-en.js → /scripts/locale.php?name=en
RewriteCond %{REQUEST_METHOD} GET|HEAD
RewriteRule ^/scripts/locale-([^\.]+).js$ /scripts/locale.php?name=$1 [last,qsappend,B]
</VirtualHost>