首页 > 请教一个nginx的二级目录配置问题

请教一个nginx的二级目录配置问题

location ~ ^/bbs/.+\.php$ {
        alias   /home/www/esotalk/;
        rewrite /bbs/(.*\.php?) /$1 break;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /home/www/esotalk$fastcgi_script_name;
        include        fastcgi_params;
    }
    location ~ ^/bbs($|/.*) {
        alias   /home/www/esotalk/$1;
        index   index.php index.html;
    }

配置如上,

程序为 esoTalk,文件摆在 /home/www/esotalk/ ,

摆安装文件进去了,访问 /bbs 时,本应该跳转去 /bbs/?p=install/info 的,但是跳转成了 /?p=install/info ,

求解决方法,谢谢。


# Achais个人博客
server {
    listen 80;
    server_name achais.com www.achais.com;
    root /a/apps/default/achais;
    index index.php index.html index.htm;

    # PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置.
    location ~ .*\.php(\/.*)*$ {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        access_log     /a/apps/nginx/logs/achais/main.access.log main;
    }
}

server {
    listen 80;
    server_name me.990t.cn;
    root /a/apps/default/achais;
    index index.php index.html index.htm;

    # PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置.
    location ~ .*\.php(\/.*)*$ {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        access_log     /a/apps/nginx/logs/achais/main.access.log main;
    }
}

不同的二级域名用server_name辨别就行了.
location ~ ..php(\/.)*$ {
# 这个location规则是针对 typecho 的.
}


如果我没记错的话,应该是这样

location ~ ^/bbs/.+\.php$ {
    alias   /home/www/esotalk/;
    rewrite /bbs/(.*\.php?) /bbs/$1 break;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /home/www/esotalk$fastcgi_script_name;
    include        fastcgi_params;
}
location ~ ^/bbs($|/.*) {
    alias   /home/www/esotalk/$1;
    index   index.php index.html;
}
【热门文章】
【热门文章】