Initial commit, seems to work
This commit is contained in:
parent
99b1b132e6
commit
401d070778
57
.env.sample
Normal file
57
.env.sample
Normal file
@ -0,0 +1,57 @@
|
||||
# .env file to set up your LEMP stack with letsencrypt
|
||||
|
||||
#
|
||||
# Network name
|
||||
#
|
||||
# Your container app must use a network conencted to your webproxy
|
||||
# https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
|
||||
#
|
||||
NETWORK=webproxy
|
||||
|
||||
|
||||
#
|
||||
# Database Container configuration
|
||||
# We recommend MySQL or MariaDB - please update docker-compose file if needed.
|
||||
#
|
||||
CONTAINER_DB_NAME=db
|
||||
|
||||
# Path to store your database
|
||||
#DB_PATH=/path/to/your/local/database/folder
|
||||
DB_PATH=./data/db
|
||||
|
||||
# Root password for your database
|
||||
MYSQL_ROOT_PASSWORD=root_password
|
||||
|
||||
# Database name, user and password for your wordpress
|
||||
MYSQL_DATABASE=database_name
|
||||
MYSQL_USER=user_name
|
||||
MYSQL_PASSWORD=user_password
|
||||
|
||||
|
||||
#
|
||||
# PHP Settings
|
||||
#
|
||||
CONTAINER_PHP_NAME=php
|
||||
|
||||
|
||||
#
|
||||
# Webroot configuration
|
||||
#
|
||||
#WEBROOT_PATH=/path/to/your/webroot
|
||||
WEBROOT_PATH=./data/www
|
||||
|
||||
|
||||
#
|
||||
# NGINX Settings
|
||||
#
|
||||
CONTAINER_NGINX_NAME=nginx
|
||||
NGINX_PORT=8081
|
||||
|
||||
#
|
||||
# Host
|
||||
#
|
||||
# Your domain (or domains)
|
||||
VIRTUAL_HOST=domain1.com,www.domain1.com
|
||||
LETSENCRYPT_HOST=domain1.com,www.domain1.com
|
||||
# Your email for Let's Encrypt register
|
||||
LETSENCRYPT_EMAIL=your_email@domain.com
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# ---> Production Config File
|
||||
.env
|
||||
|
49
docker-compose.yml
Normal file
49
docker-compose.yml
Normal file
@ -0,0 +1,49 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
container_name: ${CONTAINER_DB_NAME}
|
||||
image: mariadb:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ${DB_PATH}:/var/lib/mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||||
MYSQL_USER: ${MYSQL_USER}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
|
||||
php-fpm:
|
||||
container_name: ${CONTAINER_PHP_NAME}
|
||||
#image: php:7-fpm
|
||||
build: docker/php
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ${WEBROOT_PATH}:/var/www
|
||||
links:
|
||||
- db
|
||||
|
||||
nginx:
|
||||
container_name: ${CONTAINER_NGINX_NAME}
|
||||
image: nginx:stable
|
||||
volumes:
|
||||
- ${WEBROOT_PATH}:/var/www
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./nginx/sites/:/etc/nginx/sites-enabled
|
||||
- ./nginx/conf.d/:/etc/nginx/conf.d
|
||||
depends_on:
|
||||
- php-fpm
|
||||
ports:
|
||||
- "${NGINX_PORT}:80"
|
||||
links:
|
||||
- php-fpm
|
||||
|
||||
environment:
|
||||
VIRTUAL_HOST: ${VIRTUAL_HOST}
|
||||
LETSENCRYPT_HOST: ${LETSENCRYPT_HOST}
|
||||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: ${NETWORK}
|
3
docker/php/Dockerfile
Normal file
3
docker/php/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM php:7-fpm
|
||||
|
||||
RUN docker-php-ext-install pdo_mysql
|
3
nginx/conf.d/default.conf
Normal file
3
nginx/conf.d/default.conf
Normal file
@ -0,0 +1,3 @@
|
||||
upstream php-upstream {
|
||||
server php-fpm:9000;
|
||||
}
|
32
nginx/nginx.conf
Normal file
32
nginx/nginx.conf
Normal file
@ -0,0 +1,32 @@
|
||||
user nginx;
|
||||
worker_processes 4;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*.conf;
|
||||
}
|
33
nginx/sites/default.conf
Normal file
33
nginx/sites/default.conf
Normal file
@ -0,0 +1,33 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
server_name localhost;
|
||||
root /var/www;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
#fixes timeouts
|
||||
fastcgi_read_timeout 600;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/letsencrypt/;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user