docker run -d -p 8081:80 nginxImageID
浏览器访问:host-ip:8081nginx
2个日志: access.log,记录每一个HTTP请求信息 error.log,记录Nginx运行中的错误,用于排错 配置文件:nginx.conf docker exec -ti containerID sh # find . -name "nginx.conf" ./etc/nginx/nginx.conf # ls -l /etc/nginx total 32 drwxr-xr-x. 2 root root 25 Dec 16 17:29 conf.d -rw-r--r--. 1 root root 1007 Dec 9 15:34 fastcgi_params -rw-r--r--. 1 root root 2837 Dec 9 15:34 koi-utf -rw-r--r--. 1 root root 2223 Dec 9 15:34 koi-win -rw-r--r--. 1 root root 3957 Dec 9 15:34 mime.types -rw-r--r--. 1 root root 643 Dec 9 15:34 nginx.conf -rw-r--r--. 1 root root 636 Dec 9 15:34 scgi_params -rw-r--r--. 1 root root 664 Dec 9 15:34 uwsgi_params -rw-r--r--. 1 root root 3610 Dec 9 15:34 win-utf # find . -name "access.log" ./var/log/nginx/access.log # ls -l /var/log/nginx/ total 0 lrwxrwxrwx. 1 root root 11 Dec 16 17:29 access.log -> /dev/stdout lrwxrwxrwx. 1 root root 11 Dec 16 17:29 error.log -> /dev/stderr
挂载共享目录: /etc/nginx /var/log/nginxdocker