开发者社区> 问答> 正文

遇到奇事了,nginx伪静态突然就不起作用了。

本来网站一直正常的,刚才上服务器,wget下载了discuz的程序,是zip打包的,所以用yum install unzip安装了 unzip用来解压程序包。
然后没事做,访问网站玩玩,发现伪静态不起作用了,再然后,做了很多尝试修复之类的,都不起作用,太神奇了,难道安装unzip会对nginx有影响?有熟悉nginx的朋友能帮忙看看怎么回事吗?急呀,我网站没伪静态根本就是一死站,连接全打不开,因为连接全写成伪静态的连接的。

以下是nginx.conf配置:

user  www www;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
pid        logs/nginx.pid;

events {
    use epoll;
    worker_connections  10240;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 8m;
    sendfile        on;
    tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    gzip  on;
    server {
        listen       80;
        server_name   www.woosoo.com;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
     root   /mnt/wwwroot/dianying;
     index index.php index.html index.htm;
            rewrite ^(.*)movie(.*)\.html$ $1movie.php?id=$2 last;
     rewrite ^(.*)index(.*)\.html$ $1index.php?p=$2 last;
     rewrite ^(.*)list-([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*)-(.*)\.html$ $1list.php?p=$2&a=$3&b=$4&c=$5&d=$6 last;
     rewrite ^(.*)s(.*)-([0-9]*)-kw(.*)\.html$ $1s.php?id=$2&p=$3&s=$4 last;
     rewrite ^(.*)m([0-9]*)--(.*)\.html$ $1baidu.php?id=$2&bdhd=$3 last;
        }
location ~ .*\.(gif|jpg|jpeg|png|ico|swf|js|css)?$ {
     root   /mnt/wwwroot/dianying;
     access_log off;
     expires 30d;
}
location ~ .*\.(html|htm)?$ {
     root   /mnt/wwwroot/dianying;
     access_log off;
     expires 300;
}
        #error_page  404              404.html;
        # redirect server error pages to the static page /50x.html
        #
        #error_page   500 502 503 504  50x.html;
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /mnt/wwwroot/dianying$fastcgi_script_name;
            include        fastcgi_params;
        }
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    server {
        server_name woosoo.com;
rewrite ^(.*) http://www.woosoo.com$1 permanent;
    }
}

展开
收起
ap5001p1v 2012-08-14 18:25:55 21511 0
7 条回答
写回答
取消 提交回答
  • ok,问题已经解决了,删除了
    location ~ .*\.(html|htm)?$ {
         root   /mnt/wwwroot/dianying;
         access_log off;
         expires 300;
    }
    就行了

    学习了

    -------------------------

    回 12楼(mai126.com) 的帖子
    我是摘抄前面兄弟的解决方案。
    2012-08-15 22:25:32
    赞同 展开评论 打赏
  • Re遇到奇事了,nginx伪静态突然就不起作用了。
    有点小麻烦吧   手表品牌排名   美丽说
    2012-08-15 13:13:50
    赞同 展开评论 打赏
  • Re遇到奇事了,nginx伪静态突然就不起作用了。
    楼主那是dz 的伪静态么?

    拿过来用
    2012-08-15 12:06:48
    赞同 展开评论 打赏
  • 这个还真是比较麻烦
    2012-08-15 11:29:12
    赞同 展开评论 打赏
  • 回 4楼(ap5001p1v) 的帖子
    whereis nginx.看是不是路径不对。
    2012-08-14 20:28:59
    赞同 展开评论 打赏
  • 回1楼vpsmm的帖子
    没有错的,要有错就好了,至少知道哪有问题。

    -------------------------

    回3楼vpsmm的帖子
    试过重启nginx了,服务器重启也试了。

    -------------------------

    回5楼ap6214f2r的帖子
    路径没问题

    -------------------------

    Re遇到奇事了,nginx伪静态突然就不起作用了。
    ok,问题已经解决了,删除了
    location ~ .*\.(html|htm)?$ {
         root   /mnt/wwwroot/dianying;
         access_log off;
         expires 300;
    }
    就行了
    2012-08-14 18:31:16
    赞同 展开评论 打赏
  • Re遇到奇事了,nginx伪静态突然就不起作用了。
    执行 /etc/init.d/nginx reload 看是否有错误提示。

    -------------------------

    Re遇到奇事了,nginx伪静态突然就不起作用了。
    仔细看了一下,也没发现有什么问题啊。重启一下nginx呢?
    2012-08-14 18:29:17
    赞同 展开评论 打赏
滑动查看更多
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载