Skip to content

Instantly share code, notes, and snippets.

@nobiki
Last active November 16, 2018 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobiki/c5a4ed29119c976bb469637b8f6e2c2f to your computer and use it in GitHub Desktop.
Save nobiki/c5a4ed29119c976bb469637b8f6e2c2f to your computer and use it in GitHub Desktop.
require: composer, docker-compose
composer create-project laravel/laravel ./web v5.7.0
sudo chmod -R 777 web/storage/
tee ./web.conf << 'EOF'
server {
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /web/public;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
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;
}
}
EOF
tee ./docker-compose.yml << 'EOF'
version: '2.3'
services:
web:
# container_name: web
# hostname: web
image: nginx:stable-alpine
volumes:
- ${PWD}/web.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
php:
# container_name: php
# hostname: php
image: php:7.2.12-fpm-alpine
volumes:
- ${PWD}/web:/web
EOF
docker-compose up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment