very small, but functional Nginx server with php.
331
Dockerfile:
FROM alpine
RUN
apk --update add nginx php-fpm &&
mkdir -p /var/log/nginx &&
touch /var/log/nginx/access.log &&
mkdir -p /tmp/nginx &&
echo "clear_env = no" >> /etc/php/php-fpm.conf
#RUN \
ADD nginx.conf /etc/nginx/ RUN mkdir /www VOLUME /www EXPOSE 80 CMD php-fpm -d variables_order="EGPCS" && (tail -F /var/log/nginx/access.log &) && exec nginx -g "daemon off;"
#CMD ["bash"]
#remove ALL #s for interactive mode of this container #use this to run: docker run -it -v /www:/www -p 80:80 apox0/nginx #otherwise use this to run #docker run -d -v /www:/www -p 80:80 apox0/nginx #the container hostname can be specified with -h hostname option, default is to use docker's container name.
nginx.conf: user root; worker_processes 1;
events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream;
server {
listen 80;
server_name localhost;
root /www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
}
Content type
Image
Digest
Size
6.4 MB
Last updated
over 10 years ago
docker pull apox0/nginx