怎么在Nginx中使用codeigniter框架

今天就跟大家聊聊有关怎么在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

看完上述内容,你们对怎么在Nginx中使用codeigniter框架有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。