Nginx開啟文件目錄列表顯示功能
因為最近在搭建基於http的yum源服務器,想讓nginx顯示文件目錄列表,經過查閱資料,發現該功能默認是關閉的,需要手動開啟。
vi /application/nginx/conf/nginx.conf
#編輯nginx配置文件,在標簽內添加如下代碼:
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
代碼意義
Ø autoindex on #開啟目錄顯示功能
Ø autoindex_exact_size off #關閉詳細文件大小統計,默認為b,以kb、mb、gb為單位顯示
Ø autoindex_localtime on #開啟以服務器時區顯示文件修改日期
注意:該代碼可在http{}、server{}、location{}代碼塊顯示