apache+php的url解析流程
本帖最后由 sinxadmin 于 2012-11-16 16:26 编辑apache和php通过模块的方式集成,如果php上有url路由,在用户访问的时候怎么不让apache去解析呢?
如url:http://www.abc./com/1/2/3
apache会去匹配1/2/3的目录和文件,怎么让1/2/3直接定向给php的框架呢?
wsgi和FastCGI都有定向处理的配置:
wsgi:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / "/var/www/html/server/django.wsgi"
FastCGI:
location ~ .*\.php?$
{
include fcgi.conf;
fastcgi_pass127.0.0.1:9000;
fastcgi_index index.php;
} 楼主是django的nginx配置.
apache的php_module要求遇见.php后缀, 并采用pathinfo的方式传递uri, 比如你交给apache的url一定要是www.xxx.com/xxx.php?/a/a/b
所以用户访问http://www.xxx.com/a/a/b, 你需要配置apache rewrite先重写一下url到www.xxx.com/xxx.php?/a/a/b, 之后交给php module处理的时候就会被php module接纳了。
页:
[1]