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
| location / {
try_files $uri @apache;
}
#所有的路径都是/开头,表示匹配所有
location @apache {
internal;
proxy_pass http://127.0.0.1:1080;
include proxy.conf;
}
#url重定向至@apache规则
location ~ .*\.(php|php5)?$
{
proxy_pass http://127.0.0.1:1080;
include proxy.conf;
}
#匹配所有以.php或者.php5的URL, ~表示区分大小写
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
#匹配以.gif,.jpg,.jpeg,.png,.bmp,.swf结尾的url
location ~ .*\.(js|css)?$
{
expires 12h;
}
#匹配以.js或者.css结尾的url
|
1
2
3
4
5
6
7
8
9
10
11
12
| localtion = / {
proxy_pass http://127.0.0.1:1080/index.php;
}
#匹配根路径
localtion ~* \.(gif|jpg|jpeg|png|css|js|ico)$ {
root /web/static/;
}
#匹配所有静态文件
localtion / {
proxy_pass http://127.0.0.1:1080/index.php;
}
#匹配所有的路径
|