解析CI即CodeIgniter框架在Nginx下的重寫規(guī)則_PHP教程
推薦:深入php函數(shù)file_get_contents超時處理的方法詳解本篇文章是對php函數(shù)file_get_contents超時處理的方法進行了詳細的分析介紹,需要的朋友參考下
最近研究CI框架,發(fā)現(xiàn)這個框架的路由功能在Nginx下有問題,報404錯誤,后來在網(wǎng)上查資料,發(fā)現(xiàn)需要開啟PATH_INFO。在nginx7.16以后貌似就支持PATH_INFO了,只需要在配置文件中開啟即可。
打開nginx.conf文件,在你的虛擬主機下增加重寫規(guī)則,代碼如下:
復(fù)制代碼 代碼如下:www.hl5o.cn
server {
listen 80;
server_name www.ci.com;
location / {
root d:/www/Codeigniter_2.0.1/;
index index.html index.htm index.php;
rewrite ^/$/index.php last;
rewrite^/(?!index\.php|robots\.txt|images|js|styles)(.*)$ /index.php/$1last;
}
location ~^(.+\.php)(.*)$ {
root D:/www/Codeigniter_2.0.1/;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.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;
fastcgi_pass 127.0.0.1:9002;
include fastcgi_params;
}
}
分享:詳解PHP內(nèi)置訪問資源的超時時間 time_out file_get_contents read_file本篇文章是對PHP內(nèi)置訪問資源的超時時間time_out file_get_contents read_file進行了詳細的分析介紹,需要的朋友參考下
相關(guān)PHP教程:
- 相關(guān)鏈接:
- 教程說明:
PHP教程-解析CI即CodeIgniter框架在Nginx下的重寫規(guī)則
。