docker之nginx实战

docker之nginx实战

  • 1 搜索

    docker search nginx
    
  • 2 下载

    docker pull nginx
    
  • 3: 查看镜像

     docker images
    
  • 4:启动并映射

     docker run -d --name nginx01 -p 3344:80 nginx
     #--name 给容器命名
     #-p小写  主机端口3344:容器内端口80
     docker ps  #查看nginx正在运行当中
    
  • 测试1:阿里云服务器宿主机访问

    [root@iZwz95n2hxcdh4x6vicjmgZ ~]# curl localhost:3344
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to nginx!</title>
    <style>
        body {
             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>
    

    测试2:

    配置阿里云的安全组,安全组内实例列表,找到公网ip访问:http://8.129.187.101:3344/

    端口暴露的概念

curl 是常用的命令行工具,用来请求 Web 服务器

1: 不带有任何参数时,curl 就是发出 GET 请求。
curl https://www.example.com

2:-d参数用于发送 POST 请求的数据体
curl -d'login=emma&password=123'-X POST https://google.com/login
原文地址:https://www.cnblogs.com/zhoujun007/p/13611357.html