nginx 隐藏index.php 支持PATHINFO
2016-04-17 11:31
525 查看
隐藏index.php
在server{}中增加
location / {
root root_dir;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
支持PHP的PATHINFO
location ~* \.php {
root root_dir
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
在server{}中增加
location / {
root root_dir;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
支持PHP的PATHINFO
location ~* \.php {
root root_dir
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
相关文章推荐
- Nginx使用的php-fpm的两种进程管理方式及优化(转)
- nginx多进程锁的实现
- 分布式架构高可用架构篇_04_Keepalived+Nginx实现高可用Web负载均衡
- 使用Nginx+Lua进行Web开发
- 编译安装nginx
- linux+nginx+mysql+php
- Nginx启动/重启失败
- nginx的server_name配置
- [转] nginx 开启gzip压缩--字符串压缩比率很牛叉
- Apacche与Nginx优缺点比较
- nginx配置性能优化
- nginx lvs haproxy负载优缺点比较
- 基于Nginx1.9+LuaJIT+Kafka的点播监控系统实战(上海卓越智慧树网点播监控系统)
- nginx 一二事(1) - 简单图片服务器解决方案
- nginx 父子进程通信 channel
- Nginx与Lua
- 由Lua 粘合的Nginx生态环境
- Nginx配置Awstats分析Nginx日志笔记
- Nginx配置文件详细说明
- nginx1.8.1(稳定版本) nginx.conf 配置文件详解二