开发者社区> 问答> 正文

ngalidata的域名301跳转问题求帮助!!!

女神引技术狼
















一开始没装面板。直接装的alidata...
肠子都悔青了。。现在总不可能备案再装面板吧。。(╥﹏╥)


301在网上查了好多一直解决不阿。。


是不是在网站配置.conf文件修改301??


我就只是简单的想把 不带www的跳转到www而已!!!!!


配置文件如下。。在结尾添加呢还是在中间添加呢?
server {
        listen       80;
        server_name  www.aaa.cn aaa.cn;
    index index.html index.htm index.php;
    root /alidata/www/aaa;
    location ~ .*\.(php|php5)?$
    {
        #fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
    }
    location ~ .*\.(js|css)?$
    {
        expires 1h;
    }
    #伪静态规则
    include /alidata/server/nginx/conf/rewrite/default.conf;
    access_log  /alidata/log/nginx/access/default.log;
}

有贴子说要添加下面的代码。但是我添加后重启ng 提示错误


server
        {
                listen       80;
                server_name abc.com;
                access_log off;
                rewrite ^/(.*)$ http://www.abc.com/$1 permanent;
        }

server
        {
                listen       80;
                server_name www.abc.com;
                index index.html index.htm index.php;
                root  /home/user/abc.com;
                include location.conf;
                include zencart.conf;
        }




脑壳晕阿。。这玩意倒底怎么搞???


求助攻!!!!

展开
收起
谢单单 2014-02-28 15:50:25 9239 0
4 条回答
写回答
取消 提交回答
  • 元芳,阿里云云栖论坛总版主,phpwind官方论坛管理员,社区论坛领域应用专家。长期活跃在社区论坛建站领域,对各类社区论坛程序颇有研究!乐于交友,热心助人,以帮助和服务站长朋友为宗旨,帮助数以千计的站长朋友顺利建站!
    教程默认的环境
    301很简单的
    稍后我贴出来

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

    server {
    server_name www.gojiahe.com gojiahe.com ;
    if ($host != 'www.gojiahe.com' ) {
    rewrite ^/(.*)$ http://www.gojiahe.com/$1 permanent;
    }
    把网址替换成你自己的试试看

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

    对了。
    放顶部

    2014-02-28 17:38:33
    赞同 展开评论 打赏
  • 回2楼谢单单的帖子
    你是什么环境?alidata是什么东西?网站环境?  如果是LNMP  我还可以解决

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

    回4楼谢单单的帖子
    备份数据库  备份网站资料   重新配置服务器的环境呗
    2014-02-28 16:02:50
    赞同 展开评论 打赏
  • 回1楼小猪猪的帖子
    ( ̄_ ̄|||) 没备案这个功能就不用细说啦。。


    现在是要301跳转。。有这么难么。。。

    现在两个域名都可以访问,只是不跳转而已。。
    现在就想做跳转。。。求助攻

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

    回3楼xinling1018的帖子

    ng的。。没装面板。。。木有lnmp
    全代码。。。。。叹

    一朝棋错

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

    回8楼元芳的帖子
    加在最顶部么。。是这样么。。好像还是不行。。

    那不是有两个 server ??


    server {
    server_name www.wehudong.cn wehudong.cn;
    if ($host != 'www.wehudong.cn' ) {
    rewrite ^/(.*)$ http://www.wehudong.cn/$1 permanent;
    }

    server {
            listen       80;
            server_name  www.wehudong.cn wehudong.cn;
        index index.html index.htm index.php;
        root /alidata/www/wehudong;
        location ~ .*\.(php|php5)?$
        {
            #fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires 30d;
        }
        location ~ .*\.(js|css)?$
        {
            expires 1h;
        }
        #伪静态规则
        include /alidata/server/nginx/conf/rewrite/default.conf;
        access_log  /alidata/log/nginx/access/wehudong.log;
    }



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

    Rengalidata的域名301跳转问题求帮助!!!
    重启的时候  Xshell 提示错误

    [root@AY131129145555643a3aZ ~]# /alidata/server/nginx/sbin/nginx -s reload
    nginx: [emerg] "server" directive is not allowed here in /alidata/server/nginx/conf/vhosts/wehudong.conf:7
    [root@AY131129145555643a3aZ ~]#

    2014-02-28 15:59:20
    赞同 展开评论 打赏
  •   你的域名没有备案  可以绑定域名访问?
    2014-02-28 15:56:16
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
域名大数据的应用 立即下载
“域”见更美好的未来——域名筑梦互联网+ 立即下载
“域”感——《域名投资从入门到精通》 立即下载