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
Release: 2016-07-12 09:07:19
Original
833 people have browsed it

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;
} 
Copy after login

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

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template