Docker 安裝nginx,并掛載文件

  • 創建掛載所需目錄:
mkdir /test/server/nginx/{conf,logs,html,conf.d}
  • /test/server/nginx/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;
}
  • /test/server/nginx創建conf.d/default.conf文件,并編輯:
server {listen       80;server_name  localhost;#charset koi8-r;#access_log  /var/log/nginx/host.access.log  main;location / {root   /usr/share/nginx/html;index  index.html index.htm;}#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;#}
}
  • /test/server/nginx/html創建index.html文件,并編輯:

?

<html>
<head>
<meta charset="utf-8">
<title>Mynginx</title>
</head>
<body>
<h1>
歡迎使用自定義nginx歡迎頁!
</h1>
</body>
</html>
  • /test/server/nginx/html創建50x.html文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Error</title>
<style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;}
</style>
</head>
<body>
<h1>出現錯誤.</h1>
<p>對不起,您正在尋找的頁面目前不可用。<br/>
請稍后再試.</p>
<p>如果您是該資源的系統管理員,那么應該進行檢查詳細信息的錯誤日志.</p>
<p><em>您忠誠的, nginx.</em></p>
</body>
</html>
  • 直接啟動nginx,并實現掛載。
docker run --name nginx -d -p 8080:80 -v /test/server/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /test/server/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf -v /test/server/nginx/logs:/var/log/nginx -v /test/server/nginx/html:/usr/share/nginx/html docker.io/nginx

最終效果:

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/273659.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/273659.shtml
英文地址,請注明出處:http://en.pswp.cn/news/273659.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

http解碼-5

http://www.freebuf.com/articles/web/18084.html (1) 在 前端安全技術中常見的編碼繞過技術利用的就是不同系統間的編碼位寬(addslashes()樓哦的那個)&#xff0c;不同編碼的解碼順序(htmlParserjavascriptParser的解碼順序)&#xff0c;不同的解碼規則(unicode->ascii轉換…

IllegalArgumentException:argument type mismatch

Exception nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property id of class com.wzq.test.demo.entity.Fee with value 1211518556674199553Cause:java.lang.IllegalArgumentException: argument type mismatch 場景: 添加不傳ID使…

hadoop家族的各個成員

這篇文章不提原理&#xff0c;講講hadoop及其周邊項目的作用。 hadoop這個詞已經流行好多年了&#xff0c;一提到大數據就會想到hadoop&#xff0c;那么hadoop的作用是什么呢&#xff1f; 官方定義&#xff1a;hadoop是一個開發和執行處理大規模數據的軟件平臺。核心詞語是平臺…

ArrayList 源碼分析

介紹 ArrayList 是一個數組隊列&#xff0c;相當于 動態數組。與Java中的數組相比&#xff0c;它的容量能動態增長。 結構 ArrayList繼承于AbstractList&#xff0c;實現了List, RandomAccess, Cloneable, java.io.Serializable這些接口。如下圖&#xff1a; public class Arra…

Poj 1556 The Doors 計算幾何+最短路

其實本題非常的無腦&#xff0c;無腦拍完1A&#xff0c;寫到blog里只因為TM無腦拍也拍了很久啊 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <climits> #include <string> #include <iostr…

String equals()方法 源碼分析

public boolean equals(Object anObject) {// :比較的引用類型&#xff0c;比較的是地址值是否相同if (this anObject) { //地址值相等&#xff0c;返回truereturn true;}// instanceOf判斷一個對象是不是某個類型的實例if (anObject instanceof String) {String anotherStrin…

Google,真的要離我們而去嗎?

Google,真的要離我們而去嗎&#xff1f; 好懷念&#xff0c;真正要解決問題&#xff0c;還得搜google!轉載于:https://www.cnblogs.com/fuyujian/p/3852444.html

Oracle 位圖索引

內容簡介: 1.位圖索引 1.1位圖索引使用注意事項; 1.2 使用位圖索引; 1.3 位圖索引對DML操作的影響; 2.位圖連接索引 2.1 明確需求后使用位圖索引; 2.1創建位圖連接索引的注意事項: 1.位圖索引: 1.1位圖索引使用注意事項: ? 一般適用于低基數列; ? 適合數據倉庫; ? 對于啟用位…

oracle服務器和客戶端字符集的查看和修改

一、什么是oracle字符集 Oracle字符集是一個字節數據的解釋的符號集合,有大小之分,有相互的包容關系。ORACLE 支持國家語言的體系結構允許你使用本地化語言來存儲&#xff0c;處理&#xff0c;檢索數據。它使數據庫工具&#xff0c;錯誤消息&#xff0c;排序次序&#xff0c;日…

Java 按位運算符(,|,^,,)

&(按位與) 定義&#xff1a;針對二進制&#xff0c;只要有一個為0&#xff0c;就為0。2 & 5 02的二進制&#xff1a;00000000 00000000 00000000 000000105的二進制&#xff1a;00000000 00000000 00000000 00000101 |(按位或) 定義&#xff1a;針對二進制&#xff0c…

Oracle 多行合并一行 方法

假如有如下表&#xff0c;其中各個i值對應的行數是不定的 Sql代碼 SQL> select * from t; I A D ---------- ---------- ------------------- 1 b 2008-03-27 10:55:42 1 a 2008-03-27 10:55:46 1…

Docker 簡單入門(一)

Docker 簡介 Docker是一個開源的容器引擎&#xff0c;它有助于更快地交付應。Docker可將應用程序和基礎設施層隔離&#xff0c;并且能將基礎設施當作程序-樣進行管理。使用Docker&#xff0c;可更快地打包、測試以及部署應用程序,并可以縮短從編寫到部署運行代碼的周期。 Docke…

PDF解決方案(2)--文件轉PDF

相關專題鏈接&#xff1a; PDF解決方案&#xff08;1&#xff09;--文件上傳 PDF解決方案&#xff08;2&#xff09;--文件轉PDF PDF解決方案&#xff08;3&#xff09;--PDF轉SWF PDF解決方案&#xff08;4&#xff09;--在線瀏覽 前言&#xff1a;上一篇中講到的文件上傳&…

Docker 常用命令(二)

Docker 鏡像常用命令 搜索鏡像 可使用 docker search 命令搜索存放在 Docker Hub 中的鏡像。例如&#xff1a; docker search java 執行該命令后&#xff0c; Docker 就會在 Docker Hub 中搜索含有 java 這個關鍵詞的鏡像倉庫。執行該命令后&#xff0c;可看到類似于如下的表格…

Docker 使用Dockerfile構建Docker(三)

Dockerfile 簡單使用 先來編寫一個最簡單的 Dockerfile。 例如&#xff1a; FROM nginx RUN echo <h1>使用Dockerfile構建鏡像</h1> > /usr/share/nginx/html/index.html 該 Dockerfile 非常簡單&#xff0c;其中的 FORM 、 RUN 都是 Dockerfile 的指令。 FROM …

網絡流之最大流問題

Reference&#xff1a; http://blog.csdn.net/rrerre/article/details/6751520 http://blog.csdn.net/y990041769/article/details/21026445 http://www.nocow.cn/index.php/Translate:USACO/NetworkFlow 最大流Edmonds_Karp算法模板&#xff1a; EK算法即增廣路算法。 最大流最…

delphi讀取excel

簡單的例子 1 procedure TForm1.Button1Click(Sender: TObject);2 var3 ExcelApp,MyWorkBook: OLEVariant;4 begin5 opendialog1.Filter:Microsoft Excel Workbook (*.xls)|*.XLS|; 6 edit2.Text : sheet1;7 if opendialog1.Execute then8 begin9 edit1.Text:o…

Docker-compose 常用命令及網絡設置(五)

Docker Compose 常用命令 build 構建或重新構建服務。服務被構建后將會以 project_service的形式標記,例如:comoretest db。help 査看指定命令的幫助文檔,該命令非常實用。 docker-compose所有命令的幫助文檔都可通過該命令查看。 docker-compose he lp COMMAND 示例 docker-co…

淺談 trie樹 及其實現

定義&#xff1a;又稱字典樹&#xff0c;單詞查找樹或者前綴樹&#xff0c;是一種用于快速檢索的多叉樹結構&#xff0c; 如英文字母的字典樹是一個26叉樹&#xff0c;數字的字典樹是一個10叉樹。 核心思想&#xff1a;是空間換時間.利用字符串的公共前綴來降低查詢時間的開銷以…

Docker-compose 安裝與基本使用(四)

安裝 Docker-Compose Compose有多種安裝方式,例如通過 shell, pip以及將 Compose作為容器安裝等。本次安裝以Shell 為主。 通過以下命令自動下載并安裝適應系統版本的 Compose: curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(un…