共计 1256 个字符,预计需要花费 4 分钟才能阅读完成。
Nginx 支持 PHP 的 CI 框架
1. 找到 CI 库的配置文件修改
$config[‘base_url’] = ‘http://test.example.com’;
$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. 如果要做跳转的话,(比如:http://test.example.com/index.php/test, 跳转
http://test.example.com/test.) 可以 server 段中添加如下配置
location /{
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
推荐阅读:
Nginx 实现反向代理和负载均衡的配置及优化 http://www.linuxidc.com/Linux/2013-11/92909.htm
Nginx 做负载均衡报:nginx: [emerg] could not build the types_hash http://www.linuxidc.com/Linux/2013-10/92063.htm
Nginx 负载均衡模块 ngx_http_upstream_module 详述 http://www.linuxidc.com/Linux/2013-10/91907.htm
Nginx+Firebug 让浏览器告诉你负载均衡将请求分到了哪台服务器 http://www.linuxidc.com/Linux/2013-10/91824.htm
Ubuntu 安装 Nginx php5-fpm MySQL(LNMP 环境搭建) http://www.linuxidc.com/Linux/2012-10/72458.htm
Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里