全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 3601|回复: 4

[nginx] nginx 404 跳转 怎么写啊

[复制链接]
发表于 2009-12-17 14:25:04 | 显示全部楼层 |阅读模式
nginx.conf文件怎么写的啊,写在那里啊,
server
        {
                listen       80;
                server_name www.meiinv.com;
                server_name meiinv.com;
                index index.html index.htm index.php;
                root  /home/meiinv;

                #limit_conn   crawler  20;

                #location /status {
                #stub_status        on;
                #jiepaisiwa_log        off;
                #}
location / {
            rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
            rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
            rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
            rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
            rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
            break;
        }



                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                #fastcgi_pass  127.0.0.1:9000;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }

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

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

                log_format  meiinv  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
                access_log  /home/logs/meiinv.log  meiinv;
        }

[ 本帖最后由 qijingheng 于 2009-12-17 14:28 编辑 ]
发表于 2009-12-17 15:43:12 | 显示全部楼层

回复 1# 的帖子

域名绑定目录配置下面加个 error_page 404 /404.html; 就设定了404了
 楼主| 发表于 2009-12-17 16:35:23 | 显示全部楼层
404成功.谢谢老大
发表于 2009-12-17 16:44:08 | 显示全部楼层

回复 3# 的帖子

发表于 2009-12-17 17:58:42 | 显示全部楼层
............
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-10 13:18 , Processed in 0.058248 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表