Home >Backend Development >PHP Tutorial >lnmp enable pathinfo and hide index.php, lnmppathinfo_PHP tutorial

lnmp enable pathinfo and hide index.php, lnmppathinfo_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:07:19847browse

lnmp enables pathinfo and hides index.php, lnmppathinfo

Edit the following section:

location ~ [^/]\.php(/|$)
{       
    # comment try_files $uri =404; to enable pathinfo
    try_files $uri =404;
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
    #include pathinfo.conf;
} 

Line 1 is changed to:
location ~ [^/]\.php
Line 4 Comment out the line, that is, add # in front of it
#try_files $uri =404;
Remove the comment on line 8
include pathinfo.conf;
Add a section above location ~ [^/].php
location /
{
    if (!-e $request_filename)
    {
        rewrite "^/(.*)$" /index.php last;
    }
}
Restart Nginx
service nginx restart

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1063025.htmlTechArticlelnmp enables pathinfo and hides index.php, lnmppathinfo edits the following section: location ~ [^/].php( /|$){ # comment try_files $uri =404; to enable pathinfo try_files $uri =404; fastcgi_pa...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn