下载 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目录中去.浏览器