http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# fastcgi_intercept_errors on | off;
# 启用自定义错误页面
fastcgi_intercept_errors on;
server {
listen 80;
server_name localhost;
charset utf8;
access_log logs/80-access.log main;
error_log logs/80-error.log error;
location / {
root html;
index index.html index.htm;
}
# 使用腾讯公益404页面
error_page 404 /404.html;
location = /404.html {
root html;
}
# error_page 404 = http://www.test.com/error.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
注:404.html和50x.html都在html文件夹下,显示404页面无效