Docker Compose File

version: "2.1"
services:
  transmission:
    image: vonsy/fancyindex:1.23.3
    container_name: fancyindex
    environment:
      - PUID=3000
      - PGID=3000
      - TZ=Asia/Shanghai
      - USER=Neo
      - PASSWORD=RedPill$
    volumes:
      - /zion/share/nginx/nginx.conf:/etc/nginx/nginx.conf
      - /zion/share/private:/private
      - /zion/share/public:/public
    ports:
      - 80:80
      - 443:443
    restart: unless-stopped

Docker multi-stage builds

docker build –target builder -t fancyindexbuilder:1.23.3 . docker build -t fancyindex:1.23.3 .

Run

docker run -d \
  --name fancyindex \
  -e PUID=3000 \
  -e PGID=3000 \
  -e TZ=Asia/Shanghai \
  -e USER=Neo \
  -e PASSWORD=RedPill$ \
  -p 80:80 \
  -p 443:443 \
  -v /zion/share/nginx/nginx.conf:/etc/nginx/nginx.conf \
  -v /zion/share/private:/private \
  -v /zion/share/public:/public \
  --restart unless-stopped \
	vonsy/fancyindex:1.23.3

或者也可以不用容器,直接在Debian/Ubuntu安装.

编译安装

apt update
apt install -y ca-certificates wget libpcre3 libpcre3-dev libssl-dev zlib1g zlib1g-dev build-essential g++

./configure \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=www \
--group=www \
--with-file-aio \
--with-threads \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_realip_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--add-module=../ngx-fancyindex

make && make install

Nginx配置

fancyindex on;
fancyindex_localtime on; #on for local time zone. off for GMT
fancyindex_exact_size off; #off for human-readable. on for exact size in bytes
fancyindex_header "/fancyindex/header.html";
fancyindex_footer "/fancyindex/footer.html";
fancyindex_ignore "fancyindex"; #ignore this directory when showing list
fancyindex_hide_parent_dir on;

其它

kill -QUIT $( cat /var/run/nginx.pid )
# NGINX 流量统计
cat /var/log/nginx/access.log | awk '{sum+=$10} END {print sum/1024/1024/1024}'
# NGINX 访问IP统计
cat /var/log/nginx/access.log | awk '{print$1}' | sort | uniq -c | sort -rn
# NGINX 访问权限
auth_basic "secret";
auth_basic_user_file /etc/nginx/.htpasswd;
# 添加用户
echo "fsy:$(openssl passwd -crypt password)" >> /etc/nginx/.htpasswd
htpasswd -bc /etc/nginx/.htpasswd USER PASSWORD

链接

Github https://github.com/vonsy/fancyindex Docker https://hub.docker.com/r/vonsy/fancyindex

致谢

Use, reference the following programs, modules, themes, thanks.

http://nginx.org

https://github.com/aperezdc/ngx-fancyindex

https://github.com/TheInsomniac/Nginx-Fancyindex-Theme

https://github.com/vonsy/Nginx-Fancyindex-Theme, Fix Chinese display bugs

https://github.com/nginxinc/docker-nginx/blob/master/mainline/debian/Dockerfile