构建nginx+php-fpm的docker镜像

说明
此Dockerfile整合了nginx和php-fpm环境

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
FROM centos:7
MAINTAINER chognlai

RUN yum install -y wget epel-release && \
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm \
&& rpm -vih remi-release-7.rpm \
&& yum install -y php74-php-fpm php74-php-gd php74-php-mbstring


COPY nginx-1.19.1.tar.gz /tmp
RUN tar -xvf /tmp/nginx-1.19.1.tar.gz -C /tmp/ \
&& cd /tmp/nginx-1.19.1 \
&& yum install -y gcc-c++ gd-devel pcre-devel openssl-devel make \
&& useradd nginx -s /sbin/nologin \
&& ./configure --prefix=/usr/local/nginx \
--conf-path=/etc/nginx/nginx.conf \
--modules-path=/etc/nginx/ \
--sbin-path=/usr/sbin/nginx \
--user=nginx --group=nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_image_filter_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-debug \
--with-http_realip_module \
--with-stream \
--with-stream_ssl_preread_module \
&& make && make install

COPY nginx.conf /etc/nginx/
EXPOSE 80 443
VOLUME /etc/nginx/vhosts

CMD /opt/remi/php74/root/sbin/php-fpm && nginx -g "daemon off;"