]> git.nbdom.net Git - nb.git/commitdiff
docker nginx
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 11 Dec 2016 23:06:42 +0000 (23:06 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 11 Dec 2016 23:06:42 +0000 (23:06 +0000)
src/Docker/nginx/Dockerfile

index 1de5d89fe7667950328e18237cf11325a0344c18..659dd51cbfa11a7709c159ceb5b75101771de864 100644 (file)
@@ -3,13 +3,25 @@ FROM nginx:alpine
 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;"