Skip to content

Instantly share code, notes, and snippets.

@paulredmond
paulredmond / Caddyfile
Created Oct 12, 2017
The Caddyfile for a Laravel PHP project - https://caddyserver.com/docs/caddyfile
View Caddyfile
0.0.0.0
root /srv/app/public
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
regexp .*
ext /
to /index.php?{query}
}
@paulredmond
paulredmond / start
Created Sep 22, 2017
Bash script to start an Ubuntu Unit container
View start
#!/usr/bin/env bash
container=$(docker run --rm -d -v $(pwd)/src:/www/laravel -p 8300:8300 nginx-unit)
docker exec -ti $container curl -X PUT -d @/www/laravel/app.json --unix-socket /var/run/control.unit.sock http://localhost
echo "Container running @ $container"
echo "Here's the complete configuration object:"
docker exec -ti $container curl --unix-socket /var/run/control.unit.sock http://localhost
@paulredmond
paulredmond / app.json
Created Sep 22, 2017
Nginx Unit Configuration Object for a PHP Project
View app.json
{
"listeners": {
"*:8300": {
"application": "laravel-demo"
}
},
"applications": {
"laravel-demo": {
"type": "php",
"workers": 20,
@paulredmond
paulredmond / Dockerfile
Created Sep 22, 2017
Ubuntu Unit Dockerfile for PHP and Laravel
View Dockerfile
FROM ubuntu:xenial
RUN set -xe \
&& apt-get -y update \
&& apt-get -y install --no-install-recommends curl php \
&& curl http://nginx.org/keys/nginx_signing.key | apt-key add - \
&& echo "deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx" | tee -a /etc/apt/sources.list \
&& echo "deb-src http://nginx.org/packages/mainline/ubuntu/ xenial nginx" | tee -a /etc/apt/sources.list \
&& apt-get -y update \
&& apt-get -y install unit \
@paulredmond
paulredmond / Dockerfile
Created Sep 18, 2017
A simple Dockerfile for Apache + PHP
View Dockerfile
FROM php:7.1.8-apache
MAINTAINER Paul Redmond
COPY . /srv/app
COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
WORKDIR /srv/app
RUN docker-php-ext-install mbstring pdo pdo_mysql \
@paulredmond
paulredmond / docker-compose.yml
Created Sep 18, 2017
A Docker Compose file for an example Laravel project
View docker-compose.yml
version: '3'
services:
app:
build:
context: .
dockerfile: .docker/Dockerfile
image: laravel-docker
ports:
- 8080:80
volumes:
@paulredmond
paulredmond / docker-compose.yml
Created Sep 18, 2017
Adding a volume - a Docker Compose file for an example Laravel project
View docker-compose.yml
version: '3'
services:
app:
build:
context: .
dockerfile: .docker/Dockerfile
image: laravel-docker
ports:
- 8080:80
volumes:
@paulredmond
paulredmond / docker-compose.yml
Created Sep 18, 2017
A Docker Compose file for an example Laravel project
View docker-compose.yml
version: '3'
services:
app:
build:
context: .
dockerfile: .docker/Dockerfile
image: laravel-docker
ports:
- 8080:80
@paulredmond
paulredmond / vhost.conf
Created Sep 18, 2017
A simple Apache Vhost for Docker + PHP
View vhost.conf
<VirtualHost *:80>
DocumentRoot /srv/app/public
<Directory "/srv/app/public">
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@paulredmond
paulredmond / Dockerfile
Last active Oct 5, 2017
A simple Dockerfile for Apache + PHP
View Dockerfile
FROM php:7.1.8-apache
MAINTAINER Paul Redmond
COPY . /srv/app
COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
RUN chown -R www-data:www-data /srv/app \
&& a2enmod rewrite