server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; root "E:/phpStudy/WWW"; location / { index index.html index.htm index.php l.php; autoindex off; #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则 if (!-e $request_filename) { #地址作为将参数rewrite到index.php上。 rewrite ^/(.*)$ /index.php/$1; #若是子目录则使用下面这句,将subdir改成目录名称即可。 #rewrite ^/subdir/(.*)$ /subdir/index.php/$1; } }
修改 E:\phpStudy\nginx\conf\nginx.conf 配置文件 添加红色部分。
原文:http://www.cnblogs.com/gosky/p/5186503.html