Nginx扶植PHP的CI框架
Nginx支持PHP的CI框架
1.找到CI库的配置文件修改
$config[‘base_url’] = ”;
$config[‘uri_protocol’] = ‘PATH_INFO’;
2.找到NGINX配置.在SERVER段中添加如下代码段
location /index.php{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_param SCRIPT_FILENAME
/home/wwwroot/index.php;
fastcgi_param PATH_INFO
$fastcgi_path_info;
fastcgi_split_path_info
^(.+.php)(.*)$;
fastcgi_param PATH_TRANSLATED
$document_root$fastcgi_path_info;
include fcgi.conf;
}
3.如果要做跳转的话,(比如:
段中添加如下配置
location /{
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
推荐阅读:
Nginx实现反向代理和负载均衡的配置及优化
Nginx做负载均衡报:nginx: [emerg] could not build the types_hash
Nginx 负载均衡模块 ngx_http_upstream_module 详述
Nginx+Firebug 让浏览器告诉你负载均衡将请求分到了哪台服务器
Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建)
Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里
1.找到CI库的配置文件修改
$config[‘base_url’] = ”;
$config[‘uri_protocol’] = ‘PATH_INFO’;
2.找到NGINX配置.在SERVER段中…