nginx泛域名配置重写
server {listen 80;
server_name *.qingruxu.com;
index index.html index.htm index.php;
root /home/www/qingruxu;
#@right by : qingruxu date: 2015-07-03 15:58
location /{
if ($host ~* "news.qingruxu.com")
{
rewrite ^/$ /index.php/news last;
rewrite ^/(\d+)$ /index.php/news/$1 last;
break;
}
rewrite ^/([\w]+)$ /index.php/$1 last;
}
$host 是 nginx 提供的表示当前访问的主机是哪个
~* 不区分大小写匹配
当访问的是 news.qingruxu.com 的时候,重写使用 /index.php/news 来显示内容。
- 上一篇:修正 ifconfig fdisk 无法使用
- 下一篇:使用 gpg 验证 php