十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
這篇文章主要介紹nginx中怎么隱藏php,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
目前成都創(chuàng)新互聯(lián)已為數(shù)千家的企業(yè)提供了網(wǎng)站建設、域名、網(wǎng)頁空間、網(wǎng)站托管、企業(yè)網(wǎng)站設計、沁源網(wǎng)站維護等服務,公司將堅持客戶導向、應用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。
nginx中隱藏php的方法:首先打開相應的配置文件;然后修改內(nèi)容為“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”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!