nginx 怎么设置 404页面
时间:2016-01-07 19:09 来源:linux.it.net.cn 作者:IT
1.创建自己的404.CSS/ target=_blank class=infotextkey>Html页面
2.更改Nginx.conf在http定义区域加入:
fastCGI_intercept_errors on;
3.更改nginx.conf在server 区域加入:
error_page 404 = /404.html
nginx这边404的地址是相对于网站的根目录的。
user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
server {
listen 80 default;
server_name _;
return 403;
}
include /etc/nginx/mime.types;
Access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 60;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
# mail {
# # See sample authentication script at:
#
# # auth_http localhost/auth.PHP;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
# }
(责任编辑:IT)
1.创建自己的404.CSS/ target=_blank class=infotextkey>Html页面 2.更改Nginx.conf在http定义区域加入: fastCGI_intercept_errors on; 3.更改nginx.conf在server 区域加入: error_page 404 = /404.html nginx这边404的地址是相对于网站的根目录的。 user www-data; worker_processes 8; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; # multi_accept on; } http { server { listen 80 default; server_name _; return 403; } include /etc/nginx/mime.types; Access_log /var/log/nginx/access.log; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 60; tcp_nodelay on; gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } # mail { # # See sample authentication script at: # # # auth_http localhost/auth.PHP; # # pop3_capabilities "TOP" "USER"; # # imap_capabilities "IMAP4rev1" "UIDPLUS"; # # server { # listen localhost:110; # protocol pop3; # proxy on; # } # # server { # listen localhost:143; # protocol imap; # proxy on; # } # } (责任编辑:IT) |