当前位置 主页 > 服务器问题 > nginx问题汇总 >

    Nginx下301重定向域名的方法小结(5)

    栏目:nginx问题汇总 时间:2018-09-14 16:18


    rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
    rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;
    给discuz某版块单独配置域名

    server_name bbs.c1gstudio.com news.c1gstudio.com;

    location = / {
    if ($http_host ~ news\.c1gstudio.com$) {
    rewrite ^.+ http://news.c1gstudio.com/forum-831-1.html last;
    break;
    }
    }
    discuz ucenter 头像 rewrite 优化

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

    location /ucenter/data/avatar {
    log_not_found off;
    access_log off;
    location ~ /(.*)_big\.jpg$ {
    error_page 404 /ucenter/images/noavatar_big.gif;
    }
    location ~ /(.*)_middle\.jpg$ {
    error_page 404 /ucenter/images/noavatar_middle.gif;
    }
    location ~ /(.*)_small\.jpg$ {
    error_page 404 /ucenter/images/noavatar_small.gif;
    }
    expires 300;
    break;
    }
    }
    jspace rewrite

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

    location ~* ^/index.php/
    {
    rewrite ^/index.php/(.*) /index.php?$1 break;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    }