拦截到 404
#
# The default server
#
server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name _;
#root /usr/share/nginx/html;
return 404;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
关键配置:return 404;
重定向到指定页面
#
# The default server
#
server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name _;
#root /usr/share/nginx/html;
rewrite ^ https://yoursite.com$request_uri?;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
关键配置:rewrite ^ https://yoursite.com$request_uri?;
友情提示:本站所有文章,如无特殊说明或标注,均为何星星原创发布。与此同时,趋于近年来本站的文章内容频繁被他站盗用与机器采集,现已全局禁用网站文字内容操作,了解详情或转载文章请 点此 继续!
0 条评论