Home  >  Q&A  >  body text

fastcgi - Ask about nginx secondary directory configuration problem

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.

黄舟黄舟2712 days ago957

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 17:28:07

    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;
    }
    

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-16 17:28:07

    # 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.
    }

    reply
    0
  • Cancelreply