init
This commit is contained in:
parent
bd5518572f
commit
6103075e92
27
nginx/1.15.0/Dockerfile
Normal file
27
nginx/1.15.0/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM centos:7
|
||||
|
||||
MAINTAINER Yang <yangyu@baiwang.com>
|
||||
|
||||
ENV NGINX_VERSION=1.15.0
|
||||
|
||||
RUN yum install -y wget make gcc pcre-devel gzip zlib zlib-devel
|
||||
|
||||
RUN cd / && wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \
|
||||
&& tar -zxvf nginx-$NGINX_VERSION.tar.gz \
|
||||
&& rm -rf nginx-$NGINX_VERSION.tar.gz \
|
||||
&& cd nginx-$NGINX_VERSION \
|
||||
&& ./configure --prefix=/usr/local/nginx \
|
||||
&& make \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
&& rm -rf nginx-$NGINX_VERSION
|
||||
|
||||
RUN mkdir -p /nginx/conf && mkdir /nginx/logs/ && mkdir /nginx/www
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
COPY start.sh /
|
||||
|
||||
RUN chmod 777 /start.sh
|
||||
|
||||
ENTRYPOINT ["/start.sh"]
|
||||
8
nginx/1.15.0/start.sh
Normal file
8
nginx/1.15.0/start.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -e /nginx/conf/nginx.conf ]; then
|
||||
cp /usr/local/nginx/conf/nginx.conf /nginx/conf
|
||||
sed -i "s/mime.types/\/usr\/local\/nginx\/conf\/mime.types/" /nginx/conf/nginx.conf
|
||||
fi
|
||||
|
||||
/usr/local/nginx/sbin/nginx -c /nginx/conf/nginx.conf -g 'daemon off;'
|
||||
17
nginx/README.md
Normal file
17
nginx/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# nginx 搭建
|
||||
## 创建镜像
|
||||
进入相应的nginx版本,执行以下命令
|
||||
```bash
|
||||
docker build -t nginx:1.15.0 .
|
||||
```
|
||||
## 启动容器
|
||||
```bash
|
||||
docker run -d --name nginx-1.15.0 \
|
||||
--privileged=true \
|
||||
--restart always \
|
||||
-p 80:80 \
|
||||
-v $PWD/conf:/nginx/conf \
|
||||
-v $PWD/logs:/nginx/logs \
|
||||
-v $PWD/www:/nginx/www \
|
||||
nginx:1.15.0
|
||||
```
|
||||
Loading…
Reference in New Issue
Block a user