Simple implementation in rotation
The following is a separate virtual machine 192.168.220.135
- docker rm -f $ (docker ps -a | awk '{print $ 1}') to delete all docker, easy to start again
- docker run -itd --name = web1 -p 192.168.220.135:81:80 nginx: latest backstage start a docker container
- docker run -itd --name = web2 -p 192.168.220.135:82:80 nginx: latest background starting another container docker
- docker exec -it web1 bash into the container web1
- cd / usr / share / nginx / html / default into the path of the page
- echo 'web1'> index.html the default page write covering web1
- exit to exit the container web1
- docker exec -it web2 bash into the container web2
- cd / usr / share / nginx / html / default into the path of the page
- echo 'web2'> index.html the default page write covering web2
Here is another virtual machine 192.168.220.139
-
systemctl restart nginx Nginx ensure that service is turned on
-
cd /etc/nginx/conf.d enter the default path
-
cp default.conf jy1904.conf the default copy of the document to ensure safety
-
vim jy1904.conf edit the file copy
-
nginx -t check for syntax errors
-
systemctl reload nginx reload configuration files without restarting services
-
192.168.220.139:9999 see in the address bar in rotation effect