Last active
June 10, 2020 21:18
-
-
Save anish137i/884996bd2b1514aedae827f34c9ceffb to your computer and use it in GitHub Desktop.
Docker Nginx MariaDB redis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
php: | |
container_name: ${APP_NAME}_php | |
build: | |
context: ./docker/php | |
volumes: | |
- ./:/var/www/html | |
web: | |
container_name: ${APP_NAME}_web | |
image: nginx:1.19.0 | |
working_dir: /var/www/html | |
volumes: | |
- ./:/var/www/html | |
- ./docker/nginx/nginx_template_local.conf:/etc/nginx/conf.d/default.conf | |
ports: | |
- 9191:80 | |
db: | |
container_name: ${APP_NAME}_db | |
image: mariadb:10.5.3 | |
restart: always | |
environment: | |
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | |
MYSQL_ROOT_HOST: "%" | |
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} | |
MYSQL_DATABASE: ${DB_DATABASE} | |
MYSQL_USER: ${DB_USERNAME} | |
MYSQL_PASSWORD: ${DB_PASSWORD} | |
ports: | |
- 9306:3306 | |
volumes: | |
- ./sqldata:/var/lib/mysql | |
cache: | |
container_name: ${APP_NAME}_cache | |
image: redis:6.0.5 | |
ports: | |
- 63790:6379 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name _; | |
root /var/www/html/public; | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options "nosniff"; | |
index index.php; | |
charset utf-8; | |
access_log /dev/stdout; | |
error_log /dev/stdout; | |
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 php:9000; | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.4-fpm | |
WORKDIR /var/www/html | |
RUN apt-get update -yqq && \ | |
apt-get install -y apt-utils zip unzip && \ | |
apt-get install -y libzip-dev libpq-dev && \ | |
docker-php-ext-install pdo_mysql && \ | |
docker-php-ext-install zip && \ | |
pecl install -o -f redis-6.0.5 && \ | |
docker-php-ext-enable redis && \ | |
rm -rf /var/lib/apt/lists/* | |
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Docker Details
docker-nginx-nginx_template_local.conf is can be used from laravel only changes in fpm socket where we used default php as host and added log function
Database used MariaDB where from Local host i used port 9306 because my XAMPP enviorment use default Port