东西是参考了CU上一哥们的博文,按他的方法没成功我自己改了下,反正现在按这样配是可以重写过来了。网上有的文章说要把 “location ~ \.(php|php5)?$”后面的$去掉,但是我去掉之后url无限跳转增加.有的说要开php_info,我开了也没用
server
{
listen 80;
server_name xxxx.xxxxx.com;
root /home/wwwroot/xxxx;
location / {
index index.html index.htm index.php;
rewrite ^/(.+)$ /index.php last;
}
location ~ \.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
~
转载于:https://blog.51cto.com/sjr0313/935954