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

nginx配置404跳转页面_第1张图片
指定404页面路径

404页面代码


<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>404title>
<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">404h1>
        <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">5span> 秒钟后返回首页!li>
        ul>
    article>
section>
body>
html>

页面显示效果
nginx配置404跳转页面_第2张图片

你可能感兴趣的:(linux)