下載 http://nginx.org/download/nginx-1.12.2.tar.gzhtml
git clone https://github.com/aperezdc/ngx-fancyindex.git ngx-fancyindex
git clone https://github.com/lanffy/Nginx-Fancyindex-Theme.git
./configure --prefix=/usr/local/Cellar/nginx/1.12.2_1 --with-http_ssl_module --with-pcre --sbin-path=/usr/local/Cellar/nginx/1.12.2_1/bin/nginx --with-cc-opt='-I/usr/local/opt/pcre/include -I/usr/local/opt/openssl/include' --with-ld-opt='-L/usr/local/opt/pcre/lib -L/usr/local/opt/openssl/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-http_gzip_static_module --with-http_v2_module --add-module=../ngx-fancyindex --with-http_addition_module make
全新安裝須要make install
.nginx
已經安裝好nginx的不須要make install
,到make中生成objs目錄中執行2>&1 ./nginx -V | tr ' ' '\n'|grep fan
查看fancyindex
是否配置成功.git
而後覆蓋原有的nginx
便可.github
location /download{ include /usr/local/Cellar/nginx/1.12.2_1/html/Nginx-Fancyindex-Theme/fancyindex.conf; # 目錄美化配置 alias /Users/mac-desktop/video/; #指定目錄所在路徑 autoindex on; #開啓目錄瀏覽 autoindex_format html; #以html風格將目錄展現在瀏覽器中 autoindex_exact_size off; #切換爲 off 後,以可讀的方式顯示文件大小,單位爲 KB、MB 或者 GB autoindex_localtime on; #以服務器的文件時間做爲顯示的時間 charset utf-8,gbk; #展現中文文件名 }
將主題文件夾整個移動到nginx的html目錄中去.瀏覽器