Skip to content

Instantly share code, notes, and snippets.

@keyganker
Created December 28, 2017 09:48
Show Gist options
  • Save keyganker/f3b531f4ace1c8d71fe0b4d4c13b4b84 to your computer and use it in GitHub Desktop.
Save keyganker/f3b531f4ace1c8d71fe0b4d4c13b4b84 to your computer and use it in GitHub Desktop.
nginx配置http默认错误页面
# 主要是用到了nginx的error_page指令
server{
server_name 10.21.200.75;
listen 6666;
error_page 404 @404;
location @404 {
root /home/fey6779;
try_files /404.html =404;
}
error_page 500 @500;
location @500 {
root /home/fey6779;
try_files /500.html =500;
}
location ~ \.php {
root /home/fey6779;
fastcgi_split_path_info ^(.+\.php)(.*)$;
set $fsn /test.php;
if (-f $document_root$fastcgi_script_name) {
set $fsn $fastcgi_script_name;
}
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
fastcgi_intercept_errors on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment