配置nginx重写index.php
2016-01-27 10:44
429 查看
server {
listen 80;
server_name _;
index index.html index.htm index.php;
# 这里需要改成你网站的真实路径作为根目录
root "/www/";
# 以下配置可以让URL少写个index.php
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
# rewrite ^(.*)$ /index.php?s=$1 last; #低版本nginx使用此兼容模式来重写实现
break;
}
}
}
listen 80;
server_name _;
index index.html index.htm index.php;
# 这里需要改成你网站的真实路径作为根目录
root "/www/";
# 以下配置可以让URL少写个index.php
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
# rewrite ^(.*)$ /index.php?s=$1 last; #低版本nginx使用此兼容模式来重写实现
break;
}
}
}
相关文章推荐
- CentOS 编译安装 nginx php mysql
- Nginx服务器基础的安全配置与一些安全使用提示
- nginx上设置禁止通过ip访问服务器,只能通过域名访问
- Nginx基础入门nginx通用模板
- tornado 使用supervisor管理进程,使用nginx做负载均衡
- apache和nginx的区别
- Nginx负载均衡
- Nginx使用ngx_zeromq模块返回502错误的解决方法
- WordPress程序伪静态规则(Nginx/Apache)及二级目录规则
- Nginx+Lua开发入门
- nginx高可用负载均衡配置
- Nginx安装 与使用 转载
- nginx安装与使用
- zabbix管理七之监控nginx性能
- DJANGO技巧两则:模拟MKDIR -P及配合NGINX上传大文件不使超时
- Nginx配置文件详细说明
- flume nginx 日志处理异常 JsonParseException: Unexpected character ('(' (code 40)): expected a valid value
- nginx 配置其他路径
- nginx connection failed due to Permission denied on CentOS7
- nginx启动、重启、关闭