Nginx Directory permission Control Help
server {
Listen 80;
server_name admin.my.com;
Location/{
Root d:/www/webroot;
Index index.php;
}
error_page404 = http://admin.my.com/error.html;
Location ~ \.php$ {
Rootd:/www/webroot;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
Fastcgi_paramscript_filename D:/www/webroot$fastcgi_script_name;
Includefastcgi_params;
}
}
fastcgi.conf Configuration
The URL structure of my system (non-pseudo-static, just converted in the portal file): for example:
Http://admin.my.com/index.php/Index/image
_code
Http://admin.my.com/index.php/Admin/edit_config
Http://admin.my.com/index.php/News/add
......
index.php is a portal file, single entry
But the problem came when I visited Http://admin.my.com/index.php/Index/image_code.
In fact, the file path points to: d:/www/webroot/index.php/index/image_code/index.php
Because the location above is configured: Index index.php; Probably the suffix name in the URL is not PHP or HTML or other "physical existence" of the file, will automatically add index.php it, right??????????????????
My goal is: No matter how many slash-index.php behind the URL, the entry file can only be the front index.php, instead of the following parameters into the directory and automatically add index.php.
I know this URL structure is very irregular, but the current change to more trouble, time relationship, so in the thought there is no way to solve through nginx configuration. Seek the Great God, and beg the great fairy, thank you.
The feeling is still Apache good, all of a sudden took care of:
Serveradmin[email protected]
DocumentRoot/
ServerName admin.my.com
Alias/ "d:/www/webroot/"
Options followsymlinksmultiviews execcgi
Order Allow,deny
Allow from all
Errorlog Logs/admin-error.log
#CustomLog Logs/admin-access.log Common
Nginx Apache Server
------Solution--------------------
Location ~ \.php$
Removing PHP after the $ regular in $ means the end. The removal also tells Nginx to give all. php* files to FPM processing, not just. php.
Then change the execution file name to index.php
Fastcgi_param Script_filename d:/www/webroot/index.php;
The rest depends on your application.
This is a relatively simple configuration, want to know more perfect method, to search it yourself, this is really too much explanation