全球主机交流论坛

标题: 求助lnmp怎么设置404页啊 [打印本页]

作者: xtmp    时间: 2010-10-30 13:15
标题: 求助lnmp怎么设置404页啊
rt
作者: 小夜    时间: 2010-10-30 13:31
配置CONF文件,error_page 404 /index.php;举例:
  1. server
  2.         {
  3.                 listen       80;
  4.                 server_name www.419.at;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 root  /home/www/419.at;

  7.                 error_page 404 /index.php;

  8.                 include typecho.conf;
  9.                 location ~ .*\.(php|php5)?$
  10.                         {
  11.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  12.                                 fastcgi_index index.php;
  13.                                 include fcgi.conf;
  14.                         }

  15.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  16.                         {
  17.                                 expires      30d;
  18.                         }

  19.                 location ~ .*\.(js|css)?$
  20.                         {
  21.                                 expires      12h;
  22.                         }

  23.                 access_log off;
  24.         }
复制代码

作者: mslxd    时间: 2010-10-30 13:33
楼上的强,做个记号
作者: Globalization    时间: 2010-10-30 13:37
error_page 404 http://loc.998820.xyz/;
也可以
作者: nike_tool    时间: 2010-10-30 13:45
标题: 回复 2# 的帖子
不要跳转到主页呀 会出问题的哦
作者: xtmp    时间: 2010-10-30 13:50
不需要在nginx。conf文件中先添加
fastcgi_intercept_errors on;



直接在虚机配置文件中加error_page 404 /index.php;就可以了?
作者: serverpoint    时间: 2010-10-30 14:00
提示: 作者被禁止或删除 内容自动屏蔽
作者: amotic.tech    时间: 2010-10-30 14:04
提示: 作者被禁止或删除 内容自动屏蔽
作者: 麦田    时间: 2010-10-30 14:06
原帖由 amotic.tech 于 2010-10-30 14:04 发表
想请问一下,如果404页,我想转到一个指定的文件请问如何做..

error_page 404 /index.php

应该就是修改红字部分吧
作者: 小夜    时间: 2010-10-30 14:18
error_page 404 /404.php;

404.php 源码
  1. <? header("location:http://www.419.at"); ?>
复制代码





欢迎光临 全球主机交流论坛 (https://loc.998820.xyz/) Powered by Discuz! X3.4