File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ FROM webdevops/apache:ubuntu-16.04
22
33MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
44
5- ARG PHP_SOCKET=php-fpm:9000
5+ ARG PHP_UPSTREAM_CONTAINER=php-fpm
6+ ARG PHP_UPSTREAM_PORT=9000
67
7- ENV WEB_PHP_SOCKET=$PHP_SOCKET
8+ ENV WEB_PHP_SOCKET=${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}
89
910ENV WEB_DOCUMENT_ROOT=/var/www/public/
1011
Original file line number Diff line number Diff line change @@ -107,13 +107,14 @@ services:
107107 networks :
108108 - backend
109109
110- # ## Nginx Server Container ##################################
110+ # ## NGINX Server Container ##################################
111111
112112 nginx :
113113 build :
114114 context : ./nginx
115115 args :
116- - PHP_UPSTREAM=php-fpm
116+ - PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
117+ - PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
117118 volumes_from :
118119 - applications
119120 volumes :
@@ -146,7 +147,8 @@ services:
146147 build :
147148 context : ./apache2
148149 args :
149- - PHP_SOCKET=${PHP_SOCKET}
150+ - PHP_UPSTREAM_CONTAINER=${APACHE_PHP_UPSTREAM_CONTAINER}
151+ - PHP_UPSTREAM_PORT=${APACHE_PHP_UPSTREAM_PORT}
150152 volumes_from :
151153 - applications
152154 volumes :
Original file line number Diff line number Diff line change @@ -80,15 +80,17 @@ NGINX_HOST_HTTP_PORT=80
8080NGINX_HOST_HTTPS_PORT=443
8181NGINX_HOST_LOG_PATH=./logs/nginx/
8282NGINX_SITES_PATH=./nginx/sites/
83+ NGINX_PHP_UPSTREAM_CONTAINER=php-fpm
84+ NGINX_PHP_UPSTREAM_PORT=9000
8385
8486### APACHE #############################################################################################################
8587
8688APACHE_HOST_HTTP_PORT=80
8789APACHE_HOST_HTTPS_PORT=443
88- APACHE2_PHP_SOCKET=php-fpm:9000
8990APACHE_HOST_LOG_PATH=./logs/apache2
9091APACHE_SITES_PATH=./apache2/sites
91- PHP_SOCKET=php-fpm:9000
92+ APACHE_PHP_UPSTREAM_CONTAINER=php-fpm
93+ APACHE_PHP_UPSTREAM_PORT=9000
9294
9395### MYSQL ##############################################################################################################
9496
Original file line number Diff line number Diff line change @@ -4,17 +4,20 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
44
55ADD nginx.conf /etc/nginx/
66
7- ARG PHP_UPSTREAM=php-fpm
7+ ARG PHP_UPSTREAM_CONTAINER=php-fpm
8+ ARG PHP_UPSTREAM_PORT=9000
89
910# fix a problem--#397, change application source from dl-cdn.alpinelinux.org to aliyun source.
1011RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories
1112
1213RUN apk update \
1314 && apk upgrade \
1415 && apk add --no-cache bash \
15- && adduser -D -H -u 1000 -s /bin/bash www-data \
16- && rm /etc/nginx/conf.d/default.conf \
17- && echo "upstream php-upstream { server ${PHP_UPSTREAM}:9000; }" > /etc/nginx/conf.d/upstream.conf
16+ && adduser -D -H -u 1000 -s /bin/bash www-data
17+
18+ # Set upstream conf and remove the default conf
19+ RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \
20+ && rm /etc/nginx/conf.d/default.conf
1821
1922CMD ["nginx" ]
2023
You can’t perform that action at this time.
0 commit comments