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.mzph.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…