CodeIgniter (CI) is a lightweight PHP framework, because it was developed under the Apache server, so it needs special configuration to be used under Nginx.
Here's how:
1. application/config/config.php
modify it to about 48 lines.
$config
[
‘uri_protocol‘
] =
"PATH_INFO"
;
2. Configuring the Nginx.conf Fileserver {
Listen 80;
Listen [::]:80 Ipv6only=on;
server_name localhost;
#charset Koi8-r;
#access_log Logs/host.access.log Main;
Root share/nginx/html;
Index index.php index.html index.htm;
Location/{
#root share/nginx/html;
#index index.php index.html index.htm;
Try_files $uri $uri//index.php? $query _string;
}
Location ~ \.php ($|/) {
root localhost;//is similar to Apache's host address such as: share/nginx/html;
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 localhost$fastcgi_script_name;//localhost here refers to the full root address for example: /opt/local/share/nginx/html
Include fastcgi.conf;
}
How to configure Nginx in CI framework