server {
listen ;
server_name blog.localhost; #绑定域名
index index.htm index.html index.php; #默认文件
root /data/webroot/blog; #网站根目录
location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi_params;
}
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
access_log /data/logs/access.log;
error_log /data/logs/error.log;
}
除了首页其他大部分网页404怎么办?
把红色的加载nginx配置中就可以了。