准备 nginx.conf 文件
mkdir -p /data/nginx /data/share/files && vim /data/nginx/nginx.conf
user root;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
# server_name localhost;
charset utf-8;
root /home/nginx;
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}
}
docker run -d --name nginx-ftp -p 50000:80 --restart always --privileged=true -v /data/share/files:/usr/share/nginx/files -v /data/nginx/nginx.conf:/etc/nginx/nginx.conf -v /data/nginx/conf.d:/etc/nginx/conf.d nginx
docker