ARG WWW_ROOT
ENV WWW_ROOT=${WWW_ROOT:-/var/www/html}
+ARG PHP_HOST
+ENV PHP_HOST=${PHP_HOST:-php}
+
+ARG PHP_PORT
+ENV PHP_PORT=${PHP_PORT:-9000}
+
COPY ./default.conf /etc/nginx/conf.d/default.conf
# Set DOCUMENT_ROOT
RUN test "$WWW_ROOT" && sed -ie 's,^\([\t ]*root \).*$,\1'$WWW_ROOT';,' /etc/nginx/conf.d/default.conf
+# Set PHP_HOST
+RUN test "$PHP_HOST" && sed -ie 's,^\([\t ]*fastcgi_pass \)\([^:]\+\)\(:.*\)$,\1'$PHP_HOST'\3,' /etc/nginx/conf.d/default.conf
+
+# Set PHP_PORT
+RUN test "$PHP_PORT" && sed -ie 's,^\([\t ]*fastcgi_pass [^:]\+:\)\([0-9]\+\),\1'$PHP_PORT',' /etc/nginx/conf.d/default.conf
+
# Create default index.html
-RUN mkdir -p $WWW_ROOT && echo '<html><head><title>Welcom to Nginx</title></head><body><h1>Welcom to Nginx</h1></body></html>' > $WWW_ROOT/index.html
+RUN mkdir -p $WWW_ROOT && echo '<html><head><title>Welcom to Nginx Php Fpm</title></head><body><h1>Welcom to Nginx Php Fpm</h1></body></html>' > $WWW_ROOT/index.html
# Run daemon
-CMD nginx -g 'daemon off; error_log /dev/stdout info;'
+CMD nginx -g "daemon off; error_log /dev/stdout info;"