ngxin开启rewrite伪静态
1、编辑nginx配置文件
vi /usr/local/nginx/conf/nginx.conf #include enable-php.conf; include enable-php-pathinfo.conf;
2、在server后面加上
location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } location ~ /index.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/index.php; include fastcgi_params; fastcgi_param APPLICATION_ENV dev; }
3、保存后不要忘记重启nginx
service nginx restart 或者 nginx -s reload