Skip to content

Instantly share code, notes, and snippets.

@mul14
Last active June 4, 2022 18:55
Show Gist options
  • Save mul14/7ab87d5bf0f4a678a0f92b83d4996dfd to your computer and use it in GitHub Desktop.
Save mul14/7ab87d5bf0f4a678a0f92b83d4996dfd to your computer and use it in GitHub Desktop.
Docker compose for PHP 7.2, MySQL 5.7, Adminer
version: '3.8'
services:
nginx:
image: nginx:1.21
ports:
- "8000:80"
volumes:
- .:/var/www/html
- ./site.conf:/etc/nginx/conf.d/default.conf
php:
image: chialab/php:7.2-fpm
environment:
CI_ENV: local
volumes:
- .:/var/www/html
mysql:
image: mysql:5.7
container_name: my_database
cap_add:
- SYS_NICE
command: --default-authentication-plugin=mysql_native_password --sql-mode="ONLY_FULL_GROUP_BY"
restart: always
ports:
- "3306:3306"
volumes:
- ./mysql_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=mul14
- MYSQL_PASSWORD=my_password
- MYSQL_DATABASE=my_project
adminer:
image: adminer
restart: always
ports:
- "8001:8080"
environment:
ADMINER_DEFAULT_SERVER: mysql
server {
listen 80;
index index.html index.php;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;
location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment