Skip to content

buihanh2304/docker

Repository files navigation

Laradock mini version by HanhBT

Which is included?

  • PHP-FPM (xDebug), PHP-Worker, MailHog

  • Nginx, Apache

  • MySQL

    You can change in .env file and phpmyadmin/config.inc.php

  • Mailhog

  • Redis

    • Host: redis:6379
  • Elastic Search

    • Host: elasticsearch:9200
  • Laravel Echo Server

    • Port: 6001

How to use?

  • Clone this repository to project folder.
  • Change .env COMPOSE_PROJECT_NAME to your project name.
  • Config xDebug (optional)
  • Edit /etc/hosts, add domain for your project:
127.0.0.1 docker.dev
  • Create .conf file in apache2/sites or nginx/sites folder. Examples in these folder will help you.

  • Config SSL (optional)

  • Addition config for magento:

    • edit ./.env file:
    WORKSPACE_INSTALL_SOAP=true
    PHP_FPM_INSTALL_SOAP=true
    PHP_WORKER_INSTALL_SOAP=true
    
    • edit ./build and ./start file, add elasticsearch to each docker-composer command line
  • Run bash:

cd docker
./build
./start
  • Done!

Common use

./build # build images
./build --nc # build images without cache

./start # start docker
./stop # stop docker
./restart # stop and start docker
./restart -q # restart docker

./bash # exec to workspace bash
./bash -r # exec to workspace bash as root user
# exec to other service bash
./bash nginx
./bash php-fpm
./bash mysql
./bash phpmyadmin

Config SSL

Enable SSL for domains

cd ./ssl

cp domains.ext.example domains.ext
  • Open domains.ext, change docker.dev to your domain, or add domain with format
DNS.2 = domain.com
DNS.3 = other-domain.com
  • Add these line to docker/nginx/sites config
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/default.crt;
ssl_certificate_key /etc/nginx/ssl/default.key;

Or Apache in VirtualHost *:443 tag:

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/default.crt
SSLCertificateKeyFile /etc/apache2/ssl/default.key
  • ./restart (if needed)

Setting browsers to allow created certs

Chrome

Goto: chrome://settings/certificates > Authorities > Import > Select RootCA.crt in ./ssl

Firefox

Goto: about:preferences#privacy > View Certificates > Authorities > Import > Select RootCA.crt in ./ssl

Config xDebug

  • Edit ./.env file:
# for php-fpm debug (required)
PHP_FPM_INSTALL_XDEBUG=true

# for php-cli debug (optional)
WORKSPACE_INSTALL_XDEBUG=true

VSCode

  • Install VSCode extension: felixfbecker.php-debug
  • Create file ./.vscode/launch.json with bellow content, replace /project_path with your project path.
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "/var/www": "/project_path",
            }
        }
    ]
}

Start php-fpm debug

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published