Configure nginx to support pathinfo mode

Time:2020-11-26

Original text: https://blog.csdn.net/pangche…
The nginx server does not support pathinfo by default. In programs that require pathinfo support (such as ThinkPHP), it cannot support “pathinfo”/ index.php/Home/Index/index ”This kind of website.

Original configuration file:

location ~ \.php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
    include        fastcgi_params;
}

After revision:

Location ~ \. PHP (. *) ${ා pathinfo after regular match. PHP
    root html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
    fastcgi_ param PATH_ Info $1; ා assign pathinfo part to path_ Info variable
    include        fastcgi_params;
}

Recommended Today

Select text and add style

<!DOCTYPE html> <html lang=”en”> <head> <meta charset=”utf-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width,initial-scale=1.0″> <style> .tag.blue{ border: 3px solid rgb(32, 156, 238); background-color: rgb(32, 156, 238); } .tag.red{ border: 3px solid rgb(255, 51, 51); background-color: rgb(255, 51, 51); } .tag{ color: #fff; border-radius: 5px; font-style: normal; } .tag > .delete{ / margin-left: 5px; / background-color: rgba(10,10,10,.2); […]