Git Product home page Git Product logo

blh-dev-env's Introduction

WordPress Local Development: with Nginx + Mariadb in Docker

Before Start

Proper file permissions

Setup proper file permissions of wp-content folder so that you can use your favorite editor

There is a default USER environment variable which hold the user name of current logged-in user. We will use these variables in our docker-compose.yml file and create two environment variables to be used inside wordpress container.

Find out your user name and id by

id YOUR_USERNAME

and copy and paste the the value in .env-sample

LOCAL_USER_ID=sample_id
LOCAL_USER_NAME=sample_user

Replace the domain name in ngin.conf file

Use mkcert if you want SSL cert on localhost

  • (For ubuntu) install homebrew to be able to install [mkcert]
  • install mkcert for creating the SSL cert
  • Create SSL cert
cd cli
chmod +x create-cert.sh
./create-cert.sh

Start

  • Edit the .env-sample file with custom value, change its name to .env
  • change the server_name in nginx.conf file to your custom domain
docker-compose build 
docker-compose up -d
  • after containers up run
mkcert -install

Useful commands for debug

docker-compose build --no-cache
docker-compose up -d db
docker-compose up -d wp
docker-compose up -d nginx
docker-compose up -d php-myadmin
docker container logs CONTAINER_NAME

Reference Link about file permissions in host machine and docker container

Reference Link about mkcert

blh-dev-env's People

Contributors

jeanwang2dev avatar

Watchers

 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.