Nginx下配置codeigniter框架方法

1、修改网站配置文件

server {
    listen 80;
    server_name example.com;//自己的域名
    root /alidata/www/example;//网站目录
    index index.php index.htm index.html;
    location / {
            try_files $uri $uri/ /index.php;
    }
    location /index.php{
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME /alidata/www/example/index.php;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        include  fastcgi.conf;
    }
}

2、修改CI 的config.php 文件

$config['base_url']     = 'http://example.com/';
$config['uri_protocol'] = 'PATH_INFO';//貌似REQUEST_URI也行
$config['index_page'] = '';

3、网站根目录以及以下目录设置读写权限(777)

4、重启nginx

你可能感兴趣的:(框架)