Git Product home page Git Product logo

docker-web-env's Introduction

Docker environment for php web development

This is a docker enviroment for php web development with XDebug support and handling one or multiple websites. Easy way for obtaining SSL certificates via Let's Encrypt included.

Containers

  • nginx [latest]
  • php-fpm [7.2]
  • mysql [5.7]

Installation and configuration

$ git clone https://github.com/leepeuker/docker-web-env.git
$ cp .env.dist .env
$ make init

Important first steps:

  • Change the default configuration in the .env file
  • Edit etc/nginx/conf.d/default.conf (or remove it/add new .conf files) to customize your server/s
  • These and some other changes may require you to restart the containers to activate the new configurations ("make restart")

Directory structure

Some of these directories and files do not exist yet, but will be automatically created on the containers first start

  • build/ - Build files for docker images
  • db/ - Database files for persistant storage
  • etc/ - Configuration files for programms and services
    • letsencrypt/ - SSL certifcates, account informations, ...
    • nginx/ - Nginx configuration files
      • auth/ - Intended location for .htpasswd file (file must be created manually if needed)
      • conf.d/ - Host configuration file/s
      • nginx.conf - Server configuration file
    • php/ - PHP configuration files
      • php.ini.dev.dist - Example dev configuration file
      • php.ini.prod.dist - Example prod configuration file

Make commands

For easier interacting with docker and the container.

Format: make [command]

Command Description
up Create and start containers
down Stop and remove containers
restart Runs "down" and "up" command
build Build docker images
connect_php_bash Open bash to php-fpm container
connect_nginx_bash Open bash to nginx container
connect_mysql_cli Open mysql cli to mysql container
log_php Get php-fpm container log stream
log_mysql Get mysql container log stream
log_nginx Get nginx container log stream
log_nginx_export Copy nginx logs to host
certbot_init Initialize certbot
certbot_create Create ssl certificate/s
certbot_renew Renew existing ssl certificate/s

Install and manage SSL certifcate/s

  1. Make sure you have added your email address in the .env file (CERTBOT_EMAIL=) and your website/domain is working
  2. Run "make certbot_init" to register an account with your email address (only needed the first time)
  3. Run "make certbot_create", choose the domain/s you want to install a certifcate for and if you want automatic http to https redirects added to your nginx .conf file
  4. Simply run "make certbot_renew" to renew your certifcate/s, their lifetime is limited to 3 months

docker-web-env's People

Contributors

leepeuker avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.