03.docker nginx

nginx

docker pull nginx
​
[root@qq ~]# docker run -d --name nginx01 -p 12345:80 nginx       #-d 后台 --name 取个名字 -p 将默认的nginx 80 端口 映射为12345端口
d34a084d2ea6adb1bc2841500f56c3dcdc1607de6a2eb15f238d28fa43197b2e
[root@qq ~]# docker ps
CONTAINER ID       IMAGE               COMMAND                 CREATED             STATUS             PORTS                   NAMES
d34a084d2ea6       nginx               "nginx -g 'daemon of…"   5 seconds ago       Up 2 seconds        0.0.0.0:12345->80/tcp   nginx01
[root@qq ~]#
​
curl localhost:12345 会返回 页面html
root@qq ~]# curl localhost:12345
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
  body {
      width: 35em;
      margin: 0 auto;
      font-family: Tahoma, Verdana, Arial, sans-serif;
  }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
​
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
​
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[root@qq ~]#
​

 

posted @ 2020-05-18 16:57  ctxyytx  阅读(186)  评论(0)    收藏  举报