Coder Social home page Coder Social logo

docker-wordpress-local's Introduction

Quick Start

Use the .env file to set up your local website variables including url and database name / credentials.

cd cli

Run the add-hosts script to modify your hosts file and allow for custom domain.

bash add-hosts.sh

Run the create-cert script to create SSL certificates for local https support.

bash create-cert.sh

Change to main directory and initiate Docker to get up and running!

cd ..
docker-compose up

You should now have access to the local site dashboard and SQL database using the settings you provided in the .env file. Enjoy!


Detailed Instructions

Required setup

In order to use this you will need docker desktop installed and the mkcert utility for creating ssl certificates

check if you have it by using:

mkcert --version

if you do not, you can install with homebrew:

brew install mkcert

Getting Started

Use the .env file to define your variables. Here you can set up what you want your local site url to be as well as all the database settings that will be applied to your wp-config.php file.

Once you are happy with your setup navigate to the cli folder

cd cli

Run the two scripts:

bash add-hosts.sh

This will add a hosts file entry for your site url so that you can access it with your custom url instead of "localhost"

bash create-cert.sh

This uses the mkcert utility to generate ssl certificates and adds them to the certs folder. It may prompt you to enter your password to trust the certs when they are created.

Run Docker

Now you are ready to go! Change directories back one:

cd ..

Run docker compose and the images will be downloaded and your local instance will be setup and accessible at your custom url.

docker-compose up

docker-wordpress-local's People

Contributors

aplauche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

docker-wordpress-local's Issues

How can I uninstall the SSL cert?

Hi! This is not really an issue but more a question.
I need to uninstall the SSL cert generated by "bash create-cert.sh". I have been looking since yesterday for a way to do it but I am tired looking at so much information that Google is returning on my search and I don't understand it properly. Can you help me with this info please?
To give you more info why I think I need to uninstall/remove the SSL cert is because on my WP install I get an error
file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /var/www/html/wp-content/themes/theme/functions.php on line 160 Warning: file_get_contents(): Failed to enable crypto in /var/www/html/wp-content/themes/theme/functions.php

and this happen after I added a custom domain alias, because file_get_contents() was returning false for the custom domain, but it was working if I was using localhost as domain instead.

So, I am thinking that probably the initially generated SSL cert was not built to work with the new domain alias I added later.
For this reason I want to remove it and build it/trust it again.
I tried by removing the files from the cert folder. New files have been generated back with "bash create-cert.sh" but it seems it is not enough.

Regards,
Nick

Not working in wsl ( windows subsystem for linux )

when running docker-compose up -d ; this is the error log

I didn't touch anything except changing the domain variable in .env file from myapp.local to yasine.local ; this domain doesn't open , while the http://localhost:8080/ ( for phpmyadmin works normally ) also the wordpress files not found in var/html/www directory

image

myapp-nginx | 2022/11/17 13:49:45 [emerg] 1#1: cannot load certificate "/etc/certs/myapp.local.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/certs/myapp.local.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
myapp-nginx | nginx: [emerg] cannot load certificate "/etc/certs/myapp.local.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/certs/myapp.local.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
myapp-nginx exited with code 1

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.