麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網站 > Nginx > 正文

Docker中運行nginx并掛載本地目錄到鏡像中的方法

2024-08-30 12:30:10
字體:
來源:轉載
供稿:網友

1 從hup上pull鏡像

docker pull nginx

2 創建將要掛載的目錄

mkdir -p /data/nginx/{conf,conf.d,html,logs}

3 先要有配置文件才能啟動容器

3.1 vim /data/conf/nginx.conf

user nginx;worker_processes 1;error_log /var/log/nginx/error.log warn;pid    /var/run/nginx.pid;events {  worker_connections 1024;}http {  include    /etc/nginx/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 /var/log/nginx/access.log main;  sendfile    on;  #tcp_nopush   on;  keepalive_timeout 65;  #gzip on;  include /etc/nginx/conf.d/*.conf;}

3.2 vim /data/nginx/conf.d/default.conf

server {   listen    80;   server_name localhost;    #charset koi8-r;   #access_log /var/log/nginx/log/host.access.log main;    location / {     root  /data/nginx/html;     # root  /usr/nginx/html;     index index.html index.htm;     autoindex on;   try_files $uri /index/index/page.html;     #try_files $uri /index/map/page.html;   }    #error_page 404       /404.html;    # redirect server error pages to the static page /50x.html   #   error_page  500 502 503 504 /50x.html;   location = /50x.html {     root  /usr/share/nginx/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;   #} }

4 啟動容器

#將容器中nginx的80端口映射到本地的81端口docker run --name nginx81 -d -p 81:80 -v /data/nginx/html:/usr/share/nginx/html -v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /data/nginx/logs:/var/log/nginx -v /data/nginx/conf.d:/etc/nginx/conf.d -d nginx:latest

5 查看啟動的容器

[root@dc01 ~]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESfa56f865bd26 nginx:latest "nginx -g 'daemon of…" 4 weeks ago Up 3 seconds 0.0.0.0:80->80/tcp vigilant_swirles[root@dc01 ~]# 

6 網頁訪問nginx

Docker,nginx,掛載,本地目錄,鏡像

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到服務器教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产88久久久国产精品免费二区 | 在线成人影视 | av在线一区二区三区四区 | 中文成人在线 | 亚洲精品欧美在线 | 日日艹夜夜艹 | 一区二区三区视频播放 | www亚洲免费 | 成人做爰s片免费看网站 | 俄罗斯16一20sex牲色另类 | 免费一级毛片在线播放视频老 | 日本高清一级片 | 亚洲综合精品 | 永久免费在线观看av | 日韩欧美电影一区二区三区 | 成人午夜免费av | 国产精品视频在线观看免费 | 草人人 | av影院在线播放 | 九九热久久免费视频 | 91短视频网址 | 久久精品视频首页 | 国产精品久久久久久久久久尿 | 日韩色视频 | 成年免费大片黄在线观看岛国 | 欧美天堂一区 | 91成人在线网站 | 女人解衣喂奶电影 | 黄色va视频 | 国产欧美在线观看不卡一 | 中文字幕在线观看网址 | 亚洲一级电影在线观看 | 久久久av亚洲男天堂 | 久久久久久三区 | 久久久精品视频在线观看 | 午夜网站视频 | 黄色毛片免费视频 | 日韩黄色三级视频 | 久久人操 | 国产乱淫a∨片免费观看 | 中文字幕视频在线播放 |