PS:docker安装mysql https://blog.csdn.net/wu__peng/article/details/90905399
First create / home / nginx folder, and then put in a nginx.conf inside this folder, as follows
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;
}
And then directly execute the following command
docker run -d --name nginx_01 -p 80:80 -v /home/nginx/html:/usr/share/nginx/html -v /home/nginx/logs:/var/log/nginx -v /home/nginx/conf.d:/etc/nginx/conf.d -v /home/nginx/nginx.conf:/etc/nginx/nginx.conf nginx
The resulting container name is nginx_01, also need to listen to what -p port at home on the boot command, but also mapped folder is coupled with the -v,
I was front and resource folders in / home / nginx / html folder inside, then also need to add the configuration in the conf.d folder inside plus .conf file
It's that simple and crude