gyts62 发表于 2016-12-26 10:38:37

Nginx 环境配置 CodeIgniter 框架


[*]只有一个入口文件index.php
[*]防止js/css/images 中有PHP
  


location / {
root   /www/mydomain.com/report.mydomain.com/htdocs;
indexindex.php index.html;
if ($request_filename !~ (js|css|images|robots/.txt|index/.php) ) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log      off;
expires         7d;
}
location ~ \.php$ {
if ($request_filename !~ (index/.php) ) {
return 404;
}
}
location ~ /index.php/ {
root         html;
fastcgi_pass   127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/www/mydomain.com/report.mydomain.com/htdocs/index.php;
include      fastcgi_params;
}
 
页: [1]
查看完整版本: Nginx 环境配置 CodeIgniter 框架