Hi,
recently migrate CI app from apache to nginx. in apache it was working fine without any additional rule in .htaccess.
so I have configure nginx as recommend from nginx community. but when try to access following url it gives 404 page not found error.
http://example.com/xml_apps/index.php/xmlengine/jmprovince?category=1&count=10
Appreciate if anyone can give a suggestion to fixed this.
here is the htaccess config file.
====.htaccess
RewriteEngine On
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
=====
======nginx conf file
server {
listen 80;
root /home/ubuntu/websites/example.com/public_html/xml_apps;
index index.html index.htm index.php;
server_name example.com;
location / {
try_files $uri $uri/ /index.php;
#try_files $uri $uri/ /index.php$is_args$args;
#try_files $uri /index.php$request_uri;
#try_files $uri $uri/ /index.php/$is_args$args;
}
if (!-e $request_filename){
rewrite ^(.*)/?$ /index.php$1 last;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
======CI system/application/config/config.php ======
$config['index_page'] = "index.php";
$config['uri_protocol'] = "REQUEST_URI";
$config['enable_query_strings'] = TRUE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';