lnmp起用pathinfo并隐藏index.php

WBOY
Release: 2016-06-13 12:26:13
Original
922 people have browsed it

lnmp启用pathinfo并隐藏index.php

编辑如下区段:

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

第1行改为:
location ~ [^/]\.php
Copy after login
第4行注释掉, 即前面加#
#try_files $uri =404;
Copy after login
去掉第8行的注释
include pathinfo.conf;
Copy after login
在location ~ [^/]\.php 上面添加区段
location /{    if (!-e $request_filename)    {        rewrite "^/(.*)$" /index.php last;    }}
Copy after login
重启Nginx
service nginx restart
Copy after login
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!