Docker nginx php mysql

Docker nginx php mysql

https://github.com/nanoninja/docker-nginx-php-mysqlarrow-up-right

docker-nginx-php-mysqlarrow-up-right

Docker running Nginx, PHP-FPM, Composer, MySQL and PHPMyAdmin.

  1. Install prerequisitesarrow-up-right

    Before installing project make sure the following prerequisites have been met.

  2. Clone the projectarrow-up-right

    We’ll download the code from its repository on GitHub.

  3. Configure Nginx With SSL Certificatesarrow-up-right [Optional]

    We'll generate and configure SSL certificate for nginx before running server.

  4. Configure Xdebugarrow-up-right [Optional]

    We'll configure Xdebug for IDE (PHPStorm or Netbeans).

  5. Run the applicationarrow-up-right

    By this point we’ll have all the project pieces in place.

  6. Use Makefilearrow-up-right [Optional]

    When developing, you can use Makefile for doing recurrent operations.

  7. Use Docker Commandsarrow-up-right

    When running, you can use docker commands for doing recurrent operations.

To run the docker commands without using sudo you must add the docker group to your-user:

For now, this project has been mainly created for Unix (Linux/MacOS). Perhaps it could work on Windows.

All requisites should be available for your distribution. The most important are :

Check if docker-compose is already installed by entering the following command :

Check Docker Compose compatibility :

The following is optional but makes life more enjoyable :

On Ubuntu and Debian these are available in the meta-package build-essential. On other distributions, you may need to install the GNU C++ compiler separately.

You should be careful when installing third party web servers such as MySQL or Nginx.

This project use the following ports :

Server
Port

MySQL

8989

PHPMyAdmin

8080

Nginx

8000

Nginx SSL

3000

To install Gitarrow-up-right, download it and install following the instructions :

Go to the project directory :

You can change the host name by editing the .env file.

If you modify the host name, do not forget to add it to the /etc/hosts file.

2. Configure Nginx

If you use another IDE than PHPStormarrow-up-right or Netbeansarrow-up-right, go to the remote debuggingarrow-up-right section of Xdebug documentation.

For a better integration of Docker to PHPStorm, use the documentationarrow-up-right.

2. Edit php file etc/php/php.ini and comment or uncomment the configuration as needed. 3.

2. Start the application :

3.

4.

When developing, you can use Makefilearrow-up-right for doing the following operations :

Name
Description

apidoc

Generate documentation of API

clean

Clean directories for reset

code-sniff

Check the API with PHP Code Sniffer (PSR2)

composer-up

Update PHP dependencies with composer

docker-start

Create and start containers

docker-stop

Stop and clear all services

gen-certs

Generate SSL certificates for nginx

logs

Follow log output

mysql-dump

Create backup of all databases

mysql-restore

Restore backup of all databases

phpmd

Analyse the API with PHP Mess Detector

test

Test application with phpunit

Start the application :

Show help :

and

Notice: Replace "YOUR_DB_NAME" by your custom name.

Last updated