-
Notifications
You must be signed in to change notification settings - Fork 23
/
nginx.conf
56 lines (45 loc) · 1.31 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
server {
listen 80;
server_name www.stevelosh.com;
rewrite ^/(.*) http://stevelosh.com/$1 permanent;
}
server {
listen 80;
server_name stevelosh.com;
access_log /tmp/stevelosh.com.access.log;
error_log /tmp/stevelosh.com.error.log;
location / {
root /var/www/stevelosh.com/;
index index.html;
if ($request_uri ~ ^/blog/entry/\d+/\d/\d+/[^/]*/?$) {
rewrite ^/blog/entry/(\d+)/(\d)/\d+/([^/]*)/?$ /blog/$1/0$2/$3/ permanent;
break;
}
if ($request_uri ~ ^/blog/entry/\d+/\d\d/\d+/[^/]*/?$) {
rewrite ^/blog/entry/(\d+)/(\d\d)/\d+/([^/]*)/?$ /blog/$1/$2/$3/ permanent;
break;
}
if ($request_filename ~ ^.*.html$) {
rewrite ^(.*).html$ $1/ permanent;
break;
}
if (-f $request_filename) {
break;
}
if ($request_uri ~ ^.+[^/]$) {
rewrite ^/(.*)$ /$1/ permanent;
break;
}
if (-f $request_filename/index.html) {
rewrite ^(.*)/$ /$1/index.html;
break;
}
if ($request_filename ~ ^.*/$) {
rewrite ^/(.*)/$ /$1;
}
if (-f $request_filename.html) {
rewrite ^/(.*)$ /$1.html;
break;
}
}
}