deploy.nginx.trlgon.com

戏子无情 提交于 2019-11-28 21:55:11

hosts

lwk@qwfys:~$ cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	qwfys

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

47.101.70.212   ecs00.trlgon.com
47.100.62.192   ecs01.trlgon.com
47.103.42.39    ecs02.trlgon.com
106.15.183.59   ecs99.trlgon.com
lwk@qwfys:~$ 

  目前ecs01.trlgon.com即为生产服务器。

login to ecs01

lwk@qwfys:~$ ssh root@ecs01.trlgon.com 
Last login: Tue Aug  6 10:25:35 2019 from 183.157.56.12

Welcome to Alibaba Cloud Elastic Compute Service !

[root@node01 ~]# 

nginx

run nginx:


[root@node01 ~]# docker run -d -p 80:80 -p 443:443 -v /nginx/nginx.conf:/etc/nginx/nginx.conf:ro -v /nginx/default.conf:/etc/nginx/conf.d/default.conf -v /html/:/html/ -v /cert:/cert nginx:latest
[root@node01 ~]# docker ps 
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS              PORTS                                      NAMES
01eb112d6fb4        nginx:latest                         "nginx -g 'daemon of…"   16 minutes ago      Up 16 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   dazzling_mahavira
ed2ff70e1376        47.100.62.192:5000/center:19.7.8.3   "java -Djava.securit…"   4 weeks ago         Up 11 minutes       0.0.0.0:8083->8083/tcp, 8092/tcp           awesome_mestorf
c041ddabdd2e        registry:2                           "/entrypoint.sh /etc…"   5 months ago        Up 2 months         0.0.0.0:5000->5000/tcp                     registry2
[root@node01 ~]# 

  可以看到nginx已经启动成功。

view logger for nginx

  可以用如下命令查看nginx日志。

[root@node01 ~]# docker logs -f 01eb112d6fb4
2019/08/06 02:25:47 [warn] 1#1: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/default.conf:5
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/default.conf:5
2019/08/06 02:25:47 [warn] 1#1: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/default.conf:37
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/default.conf:37

restart nginx

  可以用如下命令重启nginx。

[root@node01 ~]# docker ps 
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS              PORTS                                      NAMES
01eb112d6fb4        nginx:latest                         "nginx -g 'daemon of…"   26 minutes ago      Up 26 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   dazzling_mahavira
ed2ff70e1376        47.100.62.192:5000/center:19.7.8.3   "java -Djava.securit…"   4 weeks ago         Up 21 minutes       0.0.0.0:8083->8083/tcp, 8092/tcp           awesome_mestorf
c041ddabdd2e        registry:2                           "/entrypoint.sh /etc…"   5 months ago        Up 2 months         0.0.0.0:5000->5000/tcp                     registry2
[root@node01 ~]# docker restart 01eb112d6fb4
01eb112d6fb4
[root@node01 ~]# 

stop nginx

  可以用如下命令关闭nginx。

[root@node01 ~]# docker stop 01eb112d6fb4
01eb112d6fb4
[root@node01 ~]#

start nginx

  可以用如下命令启动nginx。

[root@node01 ~]# docker start 01eb112d6fb4
01eb112d6fb4
[root@node01 ~]#
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!