zhltom 发表于 2018-11-9 07:20:48

NGINX支持PHP的CI框架

  nginx支持PHP的CI
  1.找到CI库的配置文件修改
  $config['base_url']   = 'http://test.example.com';
  $config['uri_protocol'] = 'PATH_INFO';
  2.找到NGINX配置.在SERVER段中添加如下代码段
  location /index.php{
  fastcgi_passunix:/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;                        }   }
页: [1]
查看完整版本: NGINX支持PHP的CI框架