亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網(wǎng)為廣大站長提供免費收錄網(wǎng)站服務,提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.430618.com 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

5f06a0dcadeb7.jpg


nginx隱藏index.php的設(shè)置方法

在訪問 http://php.cc/Att/AttList 的時候、跳轉(zhuǎn)到http://php.cc/index.php/Att/AttList ;

也就是開啟重寫功能;


在nginx配置文件nginx.conf中添加:

location / {
    if ( !e $request_filename ) {
        rewrite ^/(.*)$ /index.php/$1 last;
    }
}

如果項目入口文件是在一個子目錄里面,則如下:

location / {
    if ( !e $request_filename ) {
        rewrite ^/目錄/(.*)$ /目錄/index.php/$1 last;
    }
}

切記:不可以出現(xiàn)兩個location / {}、否則nginx服務器將啟動不了;

我的配置文件如下:

server {
    listen 80;
    server_name www.baidu.com baidu.com;
    root "D:/abc/php";
    location / {
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php?$1 last;
        }
        index index.html index.htm index.php;
        autoindex on;
    }
    location ~ \.php(.*)$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        include fastcgi_params;
    }
}

其中:

autoindex on; 是打開nginx的瀏覽目錄的功能;



分享到:
標簽:nginx 隱藏index.php 設(shè)置方法
用戶無頭像

網(wǎng)友整理

注冊時間:

網(wǎng)站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨大挑戰(zhàn)2018-06-03

數(shù)獨一種數(shù)學游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數(shù)有氧達人2018-06-03

記錄運動步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定