国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

Linux|Centos|Ubuntu|系統進程|Fedora|注冊表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務器之家 - 服務器系統 - Centos - CentOS7 Docker Nginx部署及運行詳解

CentOS7 Docker Nginx部署及運行詳解

2022-02-13 18:07lvk618 Centos

這篇文章主要介紹了CentOS7 Docker Nginx部署及運行詳解,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

網上找了一些資料部署,出現不一樣的問題,現在總結一下自己的部署流程。

1、資源準備

dockerfile文件

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# "ported" by adam miller <maxamillion@fedoraproject.org> from
#  https://github.com/fedora-cloud/fedora-dockerfiles
#
# originally written for fedora-dockerfiles by
#  scollier <scollier@redhat.com>
 
from centos:centos7
maintainer the centos project <cloud-ops@centos.org>
 
run yum -y update; yum clean all
run yum -y install epel-release tar ; yum clean all
run yum -y install nginx ; yum clean all
add nginx.conf /opt/deploy/nginx/nginx.conf
run echo "daemon off;" >> /opt/deploy/nginx/nginx.conf
#run curl https://git.centos.org/sources/httpd/c7/acf5cccf4afaecf3afeb18c50ae59fd5c6504910 \
#  | tar -xz -c /usr/local/nginx/html \
#  --strip-components=1
#run sed -i -e 's/apache/nginx/g' -e '/apache_pb.gif/d' \ 
#  /usr/local/nginx/html/index.html
 
expose 80
 
#cmd [ "/usr/local/nginx/sbin" ]

注意:路徑需要在系統上面存在以及對應

nginx.conf文件

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# for more information on configuration, see:
#  * official english documentation: http://nginx.org/en/docs/
#  * official russian documentation: http://nginx.org/ru/docs/
 
user nginx;
worker_processes 1;
 
error_log /usr/logs/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
 
pid    /run/nginx.pid;
 
 
events {
  worker_connections 1024;
}
 
 
http {
  include    mime.types;
  default_type application/octet-stream;
 
  log_format main '$remote_addr - $remote_user [$time_local] "$request" '
           '$status $body_bytes_sent "$http_referer" '
           '"$http_user_agent" "$http_x_forwarded_for"';
 
  access_log /usr/logs/nginx/access.log main;
 
  sendfile    on;
  #tcp_nopush   on;
 
  #keepalive_timeout 0;
  keepalive_timeout 65;
 
  #gzip on;
 
  # load modular configuration files from the /etc/nginx/conf.d directory.
  # see http://nginx.org/en/docs/ngx_core_module.html#include
  # for more information.
  #include /etc/nginx/conf.d/*.conf;
 
  index  index.html index.htm;
 
  server {
    listen    80;
    server_name localhost;
    root     /usr/share/nginx/html;
 
    #charset koi8-r;
 
    #access_log /var/log/nginx/host.access.log main;
 
    location / {
      autoindex on;
    }
 
    # redirect server error pages to the static page /40x.html
    #
    error_page 404       /404.html;
    location = /40x.html {
    }
 
    # redirect server error pages to the static page /50x.html
    #
    error_page  500 502 503 504 /50x.html;
    location = /50x.html {
    }
 
    # proxy the php scripts to apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #  proxy_pass  http://127.0.0.1;
    #}
 
    # pass the php scripts to fastcgi server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #  root      html;
    #  fastcgi_pass  127.0.0.1:9000;
    #  fastcgi_index index.php;
    #  fastcgi_param script_filename /scripts$fastcgi_script_name;
    #  include    fastcgi_params;
    #}
 
    # deny access to .htaccess files, if apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #  deny all;
    #}
  }
 
 
  # another virtual host using mix of ip-, name-, and port-based configuration
  #
  #server {
  #  listen    8000;
  #  listen    somename:8080;
  #  server_name somename alias another.alias;
  #  root     html;
 
  #  location / {
  #  }
  #}
 
 
  # https server
  #
  #server {
  #  listen    443;
  #  server_name localhost;
  #  root     html;
 
  #  ssl         on;
  #  ssl_certificate   cert.pem;
  #  ssl_certificate_key cert.key;
 
  #  ssl_session_timeout 5m;
 
  #  ssl_protocols sslv2 sslv3 tlsv1;
  #  ssl_ciphers high:!anull:!md5;
  #  ssl_prefer_server_ciphers  on;
 
  #  location / {
  #  }
  #}
 
}

注意:路徑需要在系統上面存在以及對應

2、執行構建鏡像命令

 

復制代碼 代碼如下:

[root@localhost nginx]# sudo docker build --rm --tag os7/nginx:centos7 . 

 

執行結果截圖:

CentOS7 Docker Nginx部署及運行詳解

3、查看鏡像是否安裝構建成功 docker images

CentOS7 Docker Nginx部署及運行詳解

4、創建容器 docker run -i -t -d -p 192.168.32.129:81:80 os7/nginx /bin/bash

注意:192.168.32.129這個ip的話,則需要在/etc/hosts中添加

192.168.32.129     localhost

5、查看容器是否創建成功并啟動 docker ps

CentOS7 Docker Nginx部署及運行詳解

6、測試是否成功訪問 curl http://192.168.32.129:81

CentOS7 Docker Nginx部署及運行詳解

會出現這個拒絕連接,那怎么辦呢?有辦法解決的,我們先進入該容器里面

7、進入容器 docker exec -i -t small_hodgkin /bin/sh

CentOS7 Docker Nginx部署及運行詳解

8、接著在容器里面執行(直接輸入即可)

nginx

9、在容器外面執行 curl http://192.168.32.129:81

CentOS7 Docker Nginx部署及運行詳解

成功了。

10、再到虛擬機外面通過瀏覽器訪問

CentOS7 Docker Nginx部署及運行詳解

到此為止就成功了。

參考資料:https://github.com/centos/centos-dockerfiles

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。

原文鏈接:http://blog.csdn.net/lk10207160511/article/details/51449762

延伸 · 閱讀

精彩推薦
  • CentosCentOS6.5下Redis安裝與配置詳細步驟

    CentOS6.5下Redis安裝與配置詳細步驟

    本篇文章主要介紹了CentOS6.5下Redis安裝與配置詳細步驟,詳細介紹redis單機單實例安裝與配置,服務及開機自啟動。有興趣的可以了解一下。...

    飛流11452021-12-24
  • Centoscentos不小心刪除/root目錄該如何解決?

    centos不小心刪除/root目錄該如何解決?

    一些朋友最近在問小編centos不小心刪除/root目錄該如何解決?今天小編就為大家分享centos不小心刪除/root目錄解決辦法;希望對大家會有幫助,有需要的朋友...

    腳本之家8022019-05-29
  • CentosCentos 7開啟網卡自動獲取IP的詳細方法

    Centos 7開啟網卡自動獲取IP的詳細方法

    本篇文章主要介紹了Centos 7開啟網卡自動獲取IP的詳細方法,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧...

    凌鋒8972021-12-29
  • CentosCentOS下Uptime命令詳解

    CentOS下Uptime命令詳解

    在Linux下,我們可以使用uptime命令,而且此命令不必使用root權限。uptime命令在系統中已經默認安裝了。今天小編為大家帶來的是CentOS下Uptime命令詳解;希望...

    CentOS之家11482019-06-19
  • CentosCentos7運用/dev/shm進行網站優化

    Centos7運用/dev/shm進行網站優化

    這篇文章主要介紹了LINUX中Centos7運用/dev/shm進行網站優化相關知識點,對此有興趣的朋友參考學習下。...

    彬菌9912022-03-02
  • CentosCentOS7設置日期和時間方法以及基本概念介紹

    CentOS7設置日期和時間方法以及基本概念介紹

    這篇文章主要介紹了CentOS7設置日期和時間方法以及基本概念介紹,本文講解使用CentOS7中的新命令timedatectl設置日期時間方法,需要的朋友可以參考下 ...

    CentOS之家6522019-09-19
  • Centoscentos 安裝與操作方法

    centos 安裝與操作方法

    這篇文章主要介紹了centos 安裝與操作方法,需要的朋友可以參考下...

    centos之家5272019-07-11
  • CentosCentOS 6.6實現永久修改DNS地址的方法

    CentOS 6.6實現永久修改DNS地址的方法

    這篇文章主要介紹了CentOS 6.6實現永久修改DNS地址的方法,涉及針對CentOS配置文件的相關設置技巧,具有一定參考借鑒價值,需要的朋友可以參考下 ...

    Linux社區4472020-08-21
主站蜘蛛池模板: 青青草综合 | 亚洲精品久久久 | 黄色成人在线观看视频 | 日韩国产欧美精品 | 热99精品| 欧美日韩视频在线第一区 | 成人免费一区二区三区视频网站 | 久久夜夜 | 久久精品一区 | 91视频网| 99精品一区二区三区 | 国产精品久久久久久一区 | 黄色免费网站 | 国产精品毛片久久久久久久 | 中文二区 | 色综合色综合 | 日韩免费视频 | 国产精品成人国产乱一区 | 欧美精品亚洲精品 | 亚洲精选一区二区 | 三级无遮挡污在线观看 | 91精品国产乱码久久久久久久久 | 91精品国产综合久久婷婷香蕉 | 极品一区| 精久久| 精品www | 亚洲天堂av在线 | 国产日韩精品一区 | www.午夜 | hsck成人网 | 成人爽a毛片一区二区免费 日韩av高清在线 | 精品国产一区二区三区小蝌蚪 | 麻豆.蜜桃.91.天美入口 | 亚洲二区视频 | 国产精品久久99 | 黄a在线观看 | 日韩在线永久免费播放 | 亚洲久久 | 成人免费黄色大片 | 成人日韩av| 综合久久久 |