codeigniter在nginx下正常访问

环境

  • codeigniter2.1    nginx1.5.2

配置

  • 打开codeignite的config.php文件修改如下:
$config['uri_protocol']	= "PATH_INFO";
  •  打开nginx.conf文件修改如下:
  • server {
            listen  80;
            server_name  example.koolbao.com; 
            root   E:/wnmp/www/example_koolbao; 
            #access_log  /www/access_ example1.log  main;
    
            location / {
                index  index.php index.html index.htm;
                #autoindex on;#如果文件不存在列出目录结构;
            }
    
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   /usr/share/nginx/html;
            }
    
            location ~ \.php {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_param   PATH_INFO $fastcgi_path_info;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }
    				
    				 
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
             }
    				
            location ~ /\.ht {
                deny  all;
            }
    }
     好了,见证奇迹的时刻到了。

     

你可能感兴趣的:(CodeIgniter)