ubuntu:20.04 with nginx, php and composer for lumen application
925
Dockerfile
FROM ubuntu:latest
MAINTAINER [email protected]
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && apt-get install git php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath nginx -y
WORKDIR /var/www/html
RUN rm -rf /var/www/html/*
RUN unlink /etc/nginx/sites-enabled/default
RUN rm /etc/nginx/sites-available/default
COPY default /etc/nginx/sites-available
RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir /usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');"
EXPOSE 80
CMD /etc/init.d/php7.4-fpm restart && nginx -g "daemon off;"
default
server {
listen 80;
root /var/www/html/lumen/public;
index index.php index.htm index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
}
Changes
v2-------------------------------
- Adjust FPM php.ini post_max_size and upload_max_filesize to 50M.
- Add client_max_body_size 100M to nginx.conf.
v2.1-----------------------------
- Install Ghostscript.
v2.2-----------------------------
- Add network-timeout.conf -> /etc/nginx/conf.d
network-timeout.conf
- proxy_read_timeout 300;
- proxy_connect_timeout 300;
- proxy_send_timeout 300;
v2.3-----------------------------
- add the below function in /etc/nginx/sites-enabled/default
- fastcgi_read_timeout 330;
v2.4-----------------------------
- adjust setting in /etc/php/7.4/fpm/pool.d/www.conf to:
- pm = dynamic
- pm.max_children = 25
- pm.start_servers = 4
- pm.min_spare_servers = 2
- pm.max_spare_servers = 20
- adjust setting in /etc/php/7.4/fpm/php.ini to
- max_execution_time 300
v2.5-----------------------------
- Consolidate running service to startup.ph and add script
#!/bin/bash
- # Restart PHP-FPM
- /etc/init.d/php7.4-fpm restart
- sleep 5
- #Change the file to executable format and ownership
- chmod +x /var/www/html/lumen/queue.sh
- chown www-data:www-data /var/www/html/lumen/queue.sh
- #run the custom sh commands
- sh /var/www/html/lumen/queue.sh
- # Start Nginx
- nginx -g "daemon off;"
- Recreate the image using Dockerfile
- FROM n0bility6/nginx-php:v2.4
- ADD startup.sh /startup.sh
- CMD ["/startup.sh"]
Content type
Image
Digest
sha256:27d50a088…
Size
169.6 MB
Last updated
over 1 year ago
docker pull n0bility6/nginx-php:v2.5