nginx常用配置与操作

rewrite有rewrite日志可以打开!
# last表示rewrite之后还会重新请求
rewrite  ^(/download/.*)/media/(.*)\..*$  $1/mp3/$2.mp3  last;

# break则表示只在location中rewrite后停止,并退出
rewrite  ^(/download/.*)/audio/(.*)\..*$  $1/mp3/$2.ra   break;


# !感叹号是取反,没有匹配的意思
location  = / {                                                                                                                                       
# matches the query / only.
[ configuration A ]-
}
location / {
# matches any query, since all queries begin with /, but regular
# expressions and any longer conventional blocks will be
# matched first.
[ configuration B ]-
}
location ^~ /images/ {
# 优先匹配并会停止匹配
# matches any query beginning with /images/ and halts searching,
# so regular expressions will not be checked.
[ configuration C ]-
}
location ~* \.(gif|jpg|jpeg)$ {
# 不区分大小写匹配
# matches any request ending in gif, jpg, or jpeg. However, all
# requests to the /images/ directory will be handled by
# Configuration C.---
[ configuration D ]-
}


[b]配置/wx/目录的访问到另一个port[/b]
    location /wx/ {
rewrite /wx(.*) $1 break;
proxy_pass http://127.0.0.1:8200;
proxy_redirect off;
proxy_set_header Host $host;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值