docker部署nginx教程

前文:Centos部署docker:https://blog.csdn.net/Virgo626249038/article/details/119087432

1、下载nginx镜像

[root@localhost ~]# docker pull nginx ####(这步可跳过,直接执行docker run命令会检测是否存在该镜像,不存在会自动去pull)
Using default tag: latest
latest: Pulling from library/nginx
33847f680f63: Already exists 
dbb907d5159d: Already exists 
8a268f30c42a: Already exists 
b10cf527a02d: Already exists 
c90b090c213b: Already exists 
1f41b2f2bf94: Already exists 
Digest: sha256:8f335768880da6baf72b70c701002b45f4932acae8d574dedfddaf967fc3ac90
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

2、启动容器

1、docker run -d -p:3333:80 nginx          ####(nginx为镜像名字,后面不带tag默认安装最新版本)
2、docker run -d -p:3333:80 08b152afcfae   ####(08b152afcfae为镜像ID,用docker images即可查看)
3、docker run -d -P nginx                  ####(-P 不指定端口,让系统随机生成)
上述命令都可以启动容器,-p、-P参数用于映射端口。

3、查看容器是否启动成功

docker ps
能看到nginx服务即为启动成功;

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS                                     
e4aeb54c6122   nginx     "/docker-entrypoint.…"   8 minutes ago    Up 8 minutes    0.0.0.0:49161->80/tcp, 

4、测试访问

[root@localhost ~]# curl localhost:3333  (测试访问;如果能看到下方的nginx信息即为访问成功)

<!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>

在这里插入图片描述
谷歌浏览器禁用的端口号:

1, // tcpmux

7, // echo

9, // discard

11, // systat

13, // daytime

15, // netstat

17, // qotd

19, // chargen

20, // ftp data

21, // ftp access

22, // ssh

23, // telnet

25, // smtp

37, // time

42, // name

43, // nicname

53, // domain

77, // priv-rjs

79, // finger

87, // ttylink

95, // supdup

101, // hostriame

102, // iso-tsap

103, // gppitnp

104, // acr-nema

109, // pop2

110, // pop3

111, // sunrpc

113, // auth

115, // sftp

117, // uucp-path

119, // nntp

123, // NTP

135, // loc-srv /epmap

139, // netbios

143, // imap2

179, // BGP

389, // ldap

465, // smtp+ssl

512, // print / exec

513, // login

514, // shell

515, // printer

526, // tempo

530, // courier

531, // chat

532, // netnews

540, // uucp

556, // remotefs

563, // nntp+ssl

587, // stmp?

601, // ??

636, // ldap+ssl

993, // ldap+ssl

995, // pop3+ssl

2049, // nfs

3659, // apple-sasl / PasswordServer

4045, // lockd

6000, // X11

6665, // Alternate IRC [Apple addition]

6666, // Alternate IRC [Apple addition]

6667, // Standard IRC [Apple addition]

6668, // Alternate IRC [Apple addition]

6669, // Alternate IRC [Apple addition]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值