nginx配置404跳转页面

nginx -s reload :修改配置后重新加载生效
nginx -s reopen :重新打开日志文件

/usr/local/nginx/conf/nginx.conf 文件存放位置
/usr/local/nginx/sbin/nginx -t 测试nginx配置程序是否运行成功
/usr/local/nginx/sbin/nginx -s reload 重启 nginx

这里写图片描述
指定404页面路径

404页面代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>404</title>
<style>
body
{
    background-color: #0A7189;
    color: #fff;
    font: 100% "Lato" , sans-serif;
    font-size: 1.8rem;
    font-weight: 300;
}

a
{
    color: #75C6D9;
    text-decoration: none;
}

h3
{
    margin-bottom: 1%;
}

ul
{
    list-style: none;
    margin: 0;
    padding: 0;
    line-height: 50px;
}
li{
    display: inline-block;
}

li a:hover
{
    color: #fff;
}

.center
{
    text-align: center;
}

/* Search Bar Styling */
form > *
{
    vertical-align: middle;
}

.srchBtn
{
    border: 0;
    border-radius: 7px;
    padding: 0 17px;
    background: #e74c3c;
    width: 99px;
    border-bottom: 5px solid #c0392b;
    color: #fff;
    height: 65px;
    font-size: 1.5rem;
    cursor: pointer;
}

.srchBtn:active
{
    border-bottom: 0px solid #c0392b;
}

.srchFld
{
    border: 0;
    border-radius: 7px;
    padding: 0 17px;
    max-width: 404px;
    width: 40%;
    border-bottom: 5px solid #bdc3c7;
    height: 60px;
    color: #7f8c8d;
    font-size: 19px;
}

.srchFld:focus
{
    outline-color: rgba(255, 255, 255, 0);
}

/* 404 Styling */
.header
{
    font-size: 13rem;
    font-weight: 700;
    margin: 2% 0 2% 0;
    text-shadow: 0px 3px 0px #7f8c8d;
}

/* Error Styling */
.error
{
    margin: -70px 0 2% 0;
    font-size: 4rem;
    text-shadow: 0px 3px 0px #7f8c8d;
    font-weight: 100;
    color: #fff;
}
</style>

<script language="javascript" type="text/javascript"> 
    var i = 5; 
    var intervalid; 
    intervalid = setInterval("fun()", 1000); 
    function fun() { 
        if (i == 0) { 
            window.location.href = "http://www.1188fc.com"; 
            clearInterval(intervalid); 
        } 
            document.getElementById("mes").innerHTML = i; 
            i--; 
    } 
</script> 

</head>
<body>
<section class="center">
    <article>
        <h1 class="header">404</h1>
        <p>页面出错,请联系管理员!</p> 
    </article>
    <article>
        <ul>
            <li><a href="http://www.1188fc.com">首页</a></li>
            <li><a href="http://1188fc.com/newhouse/">新房</a></li>
            <li><a href="http://1188fc.com/newhouse/">资讯</a></li>
            <li>将在 <span id="mes">5</span> 秒钟后返回首页!</li>
        </ul>
    </article>
</section>
</body>
</html>

页面显示效果
这里写图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

solly793755670

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值