Skip to content

Instantly share code, notes, and snippets.

@nicomollet
Last active June 16, 2023 02:18
Show Gist options
  • Save nicomollet/9d4d0ebf4a0e15de3731e086556f022b to your computer and use it in GitHub Desktop.
Save nicomollet/9d4d0ebf4a0e15de3731e086556f022b to your computer and use it in GitHub Desktop.
Lando Recipe for Yii2 (for yii2-starter-kit in multiple domains mode, with nginx)
name: SITENAME
recipe: lemp
config:
env: dev
php: '7.1'
composer_version: '1.10.19'
database: mysql
webroot: .
xdebug: false
config:
vhosts: docker/nginx/vhost.conf
services:
pma:
type: phpmyadmin
hosts:
- database
mailhog:
type: mailhog
hogfrom:
- appserver
appserver:
run:
memcached:
type: memcached:1
portforward: false
mem: 64
tooling:
composer:
service: appserver
proxy:
pma:
- pma.SITENAME.lndo.site
mailhog:
- mail.SITENAME.lndo.site
appserver_nginx:
- SITENAME.lndo.site
- storage.SITENAME.lndo.site
- backend.SITENAME.lndo.site
events:
post-start:
- appserver: which php && php --version
- appserver: which composer && composer --version
# Store this file in docker/nginx/vhost.conf
### FRONTEND
server {
listen 80 default;
listen [::]:80 default ipv6only=on;
server_name SITENAME.lndo.site;
root "{{LANDO_WEBROOT}}/frontend/web/";
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 256 128k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
include fastcgi_params;
}
}
### BACKEND
server {
listen 80;
server_name backend.SITENAME.lndo.site;
root "{{LANDO_WEBROOT}}/backend/web/";
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 256 128k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
include fastcgi_params;
}
}
### STORAGE
server {
listen 80;
server_name storage.SITENAME.lndo.site;
root "{{LANDO_WEBROOT}}/storage/web";
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 256 128k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment