forked from indieweb/chat.indieweb.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
57 lines (46 loc) · 1.78 KB
/
nginx.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
server {
listen 443 ssl http2;
server_name chat.indieweb.org;
ssl_certificate /path/to/indieweb.org.crt;
ssl_certificate_key /path/to/server.key;
access_log chat.indieweb.org.access_log main;
error_log chat.indieweb.org.error_log;
root /path/to/chat.indieweb.org/public;
index index.php;
location / {
# Today
rewrite ^/today /today.php?channel=indieweb;
rewrite ^/([a-z\-]+)/today /today.php?channel=$1;
rewrite ^/slack$ /slack.php;
# Channel name only
rewrite ^/$ /today.php?channel=indieweb;
rewrite ^/([a-z\-]+)/?$ /today.php?channel=$1;
# Calendar
rewrite ^/calendar /calendar.php?channel=indieweb;
rewrite ^/([a-z\-]+)/calendar /calendar.php?channel=$1;
# Day pages
rewrite "^/([0-9]{4}-[0-9]{2}-[0-9]{2})$" /day.php?channel=indieweb&date=$1;
rewrite "^/([a-z\-]+)/([0-9]{4}-[0-9]{2}-[0-9]{2})$" /day.php?channel=$1&date=$2;
# Chat Line Permalinks
rewrite "^/([0-9]{4}-[0-9]{2}-[0-9]{2})/([0-9]+)$" /permalink.php?channel=indieweb&date=$1×tamp=$2;
rewrite "^/([a-z\-]+)/([0-9]{4}-[0-9]{2}-[0-9]{2})/([0-9]+)$" /permalink.php?channel=$1&date=$2×tamp=$3;
}
location ~* \.php$ {
fastcgi_pass php-pool;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location /__/pub {
push_stream_publisher admin;
push_stream_channels_path $arg_id;
}
location /__/sub {
add_header 'Access-Control-Allow-Origin' '*';
push_stream_subscriber eventsource;
push_stream_channels_path $arg_id;
push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":~text~}";
push_stream_ping_message_interval 10s;
}
}