Nginx配置PATHINFO隐藏index.php
2024-10-19 06:28:43
1.网络来源:http://www.shouce.ren/post/view/id/1529
server { listen 80; default_type text/plain; root /var/www/html; index index.php index.htm index.html; #隐藏index.php location / { if (!-e $request_filename) { #一级目录 # rewrite ^/(.*)$ /index.php/$1 last; #二级目录 rewrite ^/MYAPP/(.*)$ /MYAPP/index.php/$1 last; } } #pathinfo设置 location ~ \.php($|/) { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
2.实际项目中的,我的做法(我的项目全在:application/home 下)
location / {
index index.htm index.html index.php;
try_files $uri /index.php$uri; if (!-e $request_filename) {
#一级目录
rewrite ^/(.*)$ /index.php/$1 last;
#二级目录
rewrite ^/./(.*)$ /MYAPP/index.php/$1 last;
}
}
最新文章
- mysql优化笔记之分页
- Compute Resource Consolidation Pattern 计算资源整合模式
- The Amazing ProgressBar Control(转)
- Windows 服务器使用FTP出现“当前的安全设置不允许从该位置下载文件"; 警告
- BZOJ2708 [Violet 1]木偶
- 《OD学hadoop》第三周0710
- 使用ajax()方法加载服务器数据
- ArrayList和List之间的转换
- Php 魔术常量
- Install MongoDB on Windows (Windows下安装MongoDB)
- 实现StatusBar的Flat风格
- Cocos2d-x在线粒子编辑器
- set, list 和map知识总结
- 201521123007《Java程序设计》第11周学习总结
- JAVA入门[19]-Hibernate简单示例
- HAProxy出现";远程主机强迫关闭了一个现有的连接 "; 的错误及解决
- 经典的GDB调试命令
- jenkins借助winscp传本地文件到远程服务器上
- Java8新特性值Lambda --->;匿名函数
- 5_Python OOP