解析CI即CodeIgniter框架在Nginx下的重寫規(guī)則_PHP教程
推薦:深入php函數(shù)file_get_contents超時(shí)處理的方法詳解本篇文章是對(duì)php函數(shù)file_get_contents超時(shí)處理的方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
最近研究CI框架,發(fā)現(xiàn)這個(gè)框架的路由功能在Nginx下有問題,報(bào)404錯(cuò)誤,后來在網(wǎng)上查資料,發(fā)現(xiàn)需要開啟PATH_INFO。在nginx7.16以后貌似就支持PATH_INFO了,只需要在配置文件中開啟即可。
打開nginx.conf文件,在你的虛擬主機(jī)下增加重寫規(guī)則,代碼如下:
復(fù)制代碼 代碼如下:m.dounai2.com
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)置訪問資源的超時(shí)時(shí)間 time_out file_get_contents read_file本篇文章是對(duì)PHP內(nèi)置訪問資源的超時(shí)時(shí)間time_out file_get_contents read_file進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
相關(guān)PHP教程:
- PHPNOW安裝Memcached擴(kuò)展方法詳解
- php記錄頁面代碼執(zhí)行時(shí)間
- PHP中獎(jiǎng)概率的抽獎(jiǎng)算法程序代碼
- apache設(shè)置靜態(tài)文件緩存方法介紹
- php對(duì)圖像的各種處理函數(shù)代碼小結(jié)
- PHP 關(guān)于訪問控制的和運(yùn)算符優(yōu)先級(jí)介紹
- 關(guān)于PHP語言構(gòu)造器介紹
- php/js獲取客戶端mac地址的實(shí)現(xiàn)代碼
- php5.5新數(shù)組函數(shù)array_column使用
- PHP preg_match的匹配多國(guó)語言的技巧
- php 中序列化和json使用介紹
- php采集文章中的圖片獲取替換到本地
- 相關(guān)鏈接:
- 教程說明:
PHP教程-解析CI即CodeIgniter框架在Nginx下的重寫規(guī)則。