Display a basic phpinfo().
Dockerfile :
Code: Select all
FROM evernode/sashimono:hp.latest-ubt.20.04
# Set noninteractive to avoid prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
# Update and install Nginx, PHP, and MySQL
RUN apt-get install -y software-properties-common && \
add-apt-repository ppa:ondrej/php && \
apt-get update
# Install Nginx and minimal PHP packages
RUN apt-get install -y nginx php8.1 php8.1-fpm
# Clean up apt cache to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a php site directory & index.php - phpinfo() -
RUN mkdir -p /var/www/html
RUN echo "<?php phpinfo(); ?>" > /var/www/html/index.php
RUN chown -R www-data:www-data /var/www/html && \
find /var/www/html -type d -exec chmod 755 {} \; && \
find /var/www/html -type f -exec chmod 644 {} \;
# Expose all necessary ports (no dynamic ports, just expose the range)
EXPOSE 36525-36535
# Copy start script and Nginx configuration template
COPY start.sh /start.sh
COPY nginx.conf /etc/nginx/sites-available/proj3
COPY nginx.conf /etc/nginx/sites-enabled/proj3
# Set execute permission on the start script
RUN chmod +x /start.sh
# Set entry point to start Nginx, MySQL, and PHP-FPM
ENTRYPOINT ["/start.sh"]
Code: Select all
server {
listen 36525;
listen 36526;
listen 36527;
listen 36528;
listen 36529;
listen 36530;
listen 36531;
listen 36532;
listen 36533;
listen 36534;
listen 36535;
listen 30132;
listen 30133;
listen 30135;
server_name locahost;
root /var/www/html;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
}
Code: Select all
#!/bin/bash
# Start PHP-FPM service
service php8.1-fpm start
# Start Nginx service
service nginx start
# Keep the container running
tail -f /dev/null