forked from elementary/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
81 lines (74 loc) · 2.1 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
autoindex on;
access_log off;
index index.php index.html;
# for Translations
location / {
rewrite "^/([a-z]{2}(?:_[A-Z]{2})?)/(.*)$" /$2?lang=$1 last;
try_files $uri $uri.html $uri/ @extensionless-php;
}
# for Documentation (MDR)
include /etc/nginx/mime.types;
types {
text/x-markdown md;
}
location /docs/ {
try_files $uri /docs/_mdr/index.php?$args;
}
location /branch/docs-by-mdr/docs/ {
try_files $uri /branch/docs-by-mdr/docs/_mdr/index.php?$args;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
# Hidden and Internal Files
location ~ /\. {
deny all;
}
location ~ /\_ {
deny all;
}
# Cache Static Assets until they are changed.
location ~* \.(html|css|js|png|jpg|jpeg|gif|ico|svg|eot|woff|ttf|json)$ { expires max; }
# Redirections from old site
# Trailing slashes and equals signs matter,
# be careful with the permanent redirects.
location ~ /(download|payment) {
return 301 /;
}
location ~ /(blog|journal) {
return 301 http://blog.elementary.io/;
}
# Exact match this because don't want to match /developer
# that would cause a redirection loop.
location = /develop {
return 301 /developer;
}
location /developers {
return 301 /developer;
}
location /docs/human-interface-guidelines/ {
return 301 /docs/human-interface-guidelines;
}
location /installation {
return 301 /docs/installation;
}
location /docs/user-guide {
return 301 /docs/learning-the-basics;
}
location /answers {
return 301 /support;
}
location /support/ {
return 301 /support;
}
location /generate_204 {
keepalive_timeout 0;
return 204;
}