天天看點

CI架構的資料連接配接和nginx配置

資料庫連接配接:

檔案:application/config/databases.php。

直接填寫上自己的資料庫連接配接資訊就可以了。

nginx配置

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.

2、修改CI 的config.php 檔案

$config['base_url']     = 'http://example.com/';

$config['uri_protocol'] = 'PATH_INFO';//貌似REQUEST_URI也行(重點)

$config['index_page'] = '';

3、網站根目錄以及以下目錄設定讀寫權限(777)

4、重新開機nginx

繼續閱讀