nginx给php做统一入口,Nginx如何来配置隐藏入口文件index.php(代码)
這篇文章給大家介紹的內容是關于Nginx配置 隱藏入口文件index.php,有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。
Nginx配置文件里放入這段代碼server {
location / {
index index.php index.html index.htm l.php;
autoindex on;
if (!-e $request_filename) {
#一級目錄
# rewrite ^/(.*)$ /index.php/$1 last;
#二級目錄,這里注意修改成自己的項目目錄
rewrite ^/rent/public/(.*)$ /rent/public/index.php/$1 last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
相關推薦:
ThinkPHP通過URL重寫隱藏應用的入口文件index.php
mvc模式中如何隱藏入口文件呢
PHP怎樣隱藏入口文件
總結
以上是生活随笔為你收集整理的nginx给php做统一入口,Nginx如何来配置隐藏入口文件index.php(代码)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php mysql 数据回滚,PHP m
- 下一篇: mysql+xml+注释,springb