-
Notifications
You must be signed in to change notification settings - Fork 45
/
nginx.conf
49 lines (38 loc) · 1.47 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
# phpwcms nginx configuration (examples)
#include mime.types;
#types {
# here are additional types
#video/ogg ogv
#video/ogg ogg
#video/webm webm
#}
index index.html index.php;
# All 404 error should link to phpwcms then
# it is easy to define internal routing/redirection
# error_page 404 /index.php?r404;
# Installed in Subfolder www.example.com/subfolder/
# error_page 404 /subfolder/index.php?r404;
location ~ ^/upload {
deny all;
}
location ~ ^/filearchive {
deny all;
}
# Use location - always start in Document Root
location / {
# location /subfolder/ { # If installed in a subfolder
if (!-e $request_filename){
# Redirect /en and /en/ to english home
rewrite "^/(en|de)(/{0,1})$" /index.php?$1/index break;
# Resized image /img/cmsimage.php/… -> /im/…
rewrite ^/im\/(.+?)$ /img/cmsimage.php?$1 break;
# File download /dl/… -> /download.php?…
rewrite ^/dl\/([a-fA-Z0-9]+)\/(.*?)$ /download.php?f=$1&$query_string break;
# In case of config setting `$phpwcms['rewrite_ext']='.html'` -> /alias.html (Default)
rewrite ^/(.+)\.html$ /index.php?$1&$query_string break;
rewrite ^/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.html$ /index.php?id=$1,$2,$3,$4,$5,$6&$query_string break;
# Rewrite anything else and link it against phpwcms
# Check redirect settings under admin in the backend
rewrite ^/(.+)/?$ /index.php?$1&$query_string;
}
}