fastcgi - Ask about nginx secondary directory configuration problem
黄舟
黄舟 2017-05-16 17:26:07
0
2
975
location ~ ^/bbs/.+\.php$ {
        alias   /home/www/esotalk/;
        rewrite /bbs/(.*\.php?) / 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/;
        index   index.php index.html;
    }

Configuration is as above,

The program is esoTalk, the file is placed in /home/www/esotalk/,

The installation file is entered. When accessing /bbs, it should jump to /bbs/?p=install/info, but it jumps to /?p=install/info,

Looking for a solution, thank you.

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
Ty80

If I remember correctly, it should be like this

location ~ ^/bbs/.+\.php$ {
    alias   /home/www/esotalk/;
    rewrite /bbs/(.*\.php?) /bbs/ 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/;
    index   index.php index.html;
}
大家讲道理
# 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;
    }
}

Just use server_name to identify different second-level domain names.
location ~ ..php(/.)*$ {
# This location rule is for typecho.
}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!