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
    
    
    
    Welcome to nginx!
    
    
    
    

    Welcome to nginx!

    If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

    For online documentation and support please refer to nginx.org.
    Commercial support is available at nginx.com.

    Thank you for using nginx.

    测试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