這篇文章主要介紹nginx中怎么隱藏php,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

nginx中隱藏php的方法:首先打開相應的配置文件;然后修改內容為“server{listen 80;server_name jiqing.dexin.com;index index.html index.php...”即可。
nginx 配置隱藏index.php效果
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}完整如下
server
{
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name jiqing.dexin.com;
index index.html index.htm index.php admin.php;
root /home/wwwroot/default/dexin/dragon/public;
#error_page 404 /404.html;
include enable-php-pathinfo.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
access_log /home/wwwlogs/access.log;
}它的功能很簡單,如果請求的文件不存在,自動加上index.php。
這樣,它既支持index.php/Home/index。也支持/Home/index。
以上是“nginx中怎么隱藏php”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創新互聯行業資訊頻道!
標題名稱:nginx中怎么隱藏php-創新互聯
網頁URL:http://www.yijiale78.com/article26/cesejg.html
成都網站建設公司_創新互聯,為您提供靜態網站、定制網站、商城網站、網站內鏈、網站建設、微信小程序
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯