Sign inSign up

itvci/php7.4-nginx

By itvci

•Updated about 1 year ago

php7.4-nginx

Image
0

95

itvci/php7.4-nginx repository overview

Resource - Framework (Aplikasi ini menggunakan framework Laravel) - Versi PHP (Aplikasi ini menggunakan versi PHP8) - Arsitektur (Untuk infrastruktur bisa menggunakan nginx/apache).

⁠Sekarang kita buat konfigurasi vhost untuk nginx:

server {

listen 80;
server_name _;
root /var/www/massam/public;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

index index.php;

charset utf-8;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; log_not_found off; }

error_page 404 /index.php;

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
}

location ~ /\.(?!well-known).* {
    deny all;
}

}


⁠Buat Dockerfile :

⁠Ubuntu 20.04 sebagai infrastruktur

FROM ubuntu:20.04 ENV TZ="Asia/Jakarta" ARG COMPOSER_TOKEN ENV COMPOSER_TOKEN=${COMPOSER_TOKEN} ENV DEBIAN_FRONTEND=noninteractive

⁠nginx, php7, apache

nginx supervisor php-fpm php-mysqli php-pdo php-curl php-print php-intl php-cli php-mbstring php-zip php-gd php-xml php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip nano vim composer

libxml2-dev libgmp-dev zip npm zlib1g-dev libpng-dev libonig-dev git unzip tzdata npm

⁠Install composer

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer RUN mkdir /root/.composer && echo "${COMPOSER_TOKEN}" > /root/.composer/auth.json

⁠Install Tools

wget nano mcrypt cron ssh telnetd iputils-ping

⁠Install Git

RUN apt-get install -y git RUN git --version

⁠Copy vhost ke container

COPY default /etc/nginx/sites-available/default

⁠Copy source code ke dalam container

RUN mkdir /var/www/massam chown -R www-data:www-data /var/www/massam chmod -R 755 /var/www/massam

⁠Copy file .env ke dalam container

#COPY .env /var/www/massam/.env

⁠Aktifkan php-fpm

RUN service nginx restart RUN service ssh restart RUN service php7.4-fpm restart RUN service cron restart

CMD service php7.4-fpm start && nginx -g "daemon off;"

Tag summary

Content type

Image

Digest

sha256:e8251b1f9…

Size

223.4 MB

Last updated

about 1 year ago

docker pull itvci/php7.4-nginx:tagname