You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-278Lines changed: 3 additions & 278 deletions
Original file line number
Diff line number
Diff line change
@@ -23,286 +23,11 @@ Use WordPress locally with Docker using [Docker compose](https://docs.docker.com
23
23
- PhpMyAdmin config in `./config`
24
24
+[CLI script](https://github.com/urre/wordpress-nginx-docker-compose#:~:text=6%20minutes%20ago-,cli,-Use%20%2Dinstall%20for) to create a SSL certificate using [mkcert](https://github.com/FiloSottile/mkcert)
25
25
26
-
## Instructions
26
+
## Instructions and help
27
27
28
-
<details>
29
-
<summary>Requirements</summary>
28
+
See the new [Wiki](https://github.com/urre/wordpress-nginx-docker-compose/wiki)
30
29
31
-
+[Docker](https://www.docker.com/get-started)
32
-
+[mkcert](https://github.com/FiloSottile/mkcert) for creating the SSL cert.
33
-
34
-
Install mkcert:
35
-
36
-
```
37
-
brew install mkcert
38
-
brew install nss # if you use Firefox
39
-
```
40
-
41
-
</details>
42
-
43
-
<details>
44
-
<summary>Setup</summary>
45
-
46
-
### Setup Environment variables
47
-
48
-
Both step 1. and 2. below are required:
49
-
50
-
#### 1. For Docker and the CLI script (Required step)
51
-
52
-
Copy `.env.example` in the project root to `.env` and edit your preferences.
53
-
54
-
Example:
55
-
56
-
```dotenv
57
-
IP=127.0.0.1
58
-
APP_NAME=myapp
59
-
DOMAIN="myapp.local"
60
-
DB_HOST=mysql
61
-
DB_NAME=myapp
62
-
DB_ROOT_PASSWORD=password
63
-
DB_TABLE_PREFIX=wp_
64
-
```
65
-
66
-
#### 2. For WordPress (Required step)
67
-
68
-
Edit `./src/.env.example` to your needs. During the `composer create-project` command described below, an `./src/.env` will be created.
69
-
70
-
Example:
71
-
72
-
```dotenv
73
-
DB_NAME='myapp'
74
-
DB_USER='root'
75
-
DB_PASSWORD='password'
76
-
77
-
# Optionally, you can use a data source name (DSN)
78
-
# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables
# Generate your keys here: https://roots.io/salts.html
91
-
AUTH_KEY='generateme'
92
-
SECURE_AUTH_KEY='generateme'
93
-
LOGGED_IN_KEY='generateme'
94
-
NONCE_KEY='generateme'
95
-
AUTH_SALT='generateme'
96
-
SECURE_AUTH_SALT='generateme'
97
-
LOGGED_IN_SALT='generateme'
98
-
NONCE_SALT='generateme'
99
-
```
100
-
101
-
</details>
102
-
103
-
<details>
104
-
<summary>Option 1). Use HTTPS with a custom domain</summary>
105
-
106
-
1. Create a SSL cert:
107
-
108
-
```shell
109
-
cd cli
110
-
./create-cert.sh
111
-
```
112
-
113
-
This script will create a locally-trusted development certificates. It requires no configuration.
114
-
115
-
> mkcert needs to be installed like described in Requirements. Read more for [Windows](https://github.com/FiloSottile/mkcert#windows) and [Linux](https://github.com/FiloSottile/mkcert#linux)
116
-
117
-
1b. Make sure your `/etc/hosts` file has a record for used domains. On Windows the hosts file can be find at `C:\Windows\System32\drivers\etc`. Make sure to open it with admin rights.
118
-
119
-
```
120
-
sudo nano /etc/hosts
121
-
```
122
-
123
-
Add your selected domain like this:
124
-
125
-
```
126
-
127.0.0.1 myapp.local
127
-
```
128
-
129
-
2. Continue on the Install step below
130
-
131
-
</details>
132
-
133
-
<details>
134
-
<summary>Option 2). Use a simple config</summary>
135
-
136
-
1. Edit `nginx/default.conf.conf` to use this simpler config (without using a cert and HTTPS)
> You can use this command first after you've installed WordPress using Composer as the example above.
249
-
250
-
### Update plugins and themes from wp-admin?
251
-
252
-
You can, but I recommend to use Composer for this only. But to enable this edit `./src/config/environments/development.php` (for example to use it in Dev)
253
-
254
-
```shell
255
-
Config::define('DISALLOW_FILE_EDIT', false);
256
-
Config::define('DISALLOW_FILE_MODS', false);
257
-
```
258
-
259
-
### Useful Docker Commands
260
-
261
-
When making changes to the Dockerfile, use:
262
-
263
-
```bash
264
-
docker-compose up -d --force-recreate --build
265
-
```
266
-
267
-
Login to the docker container
268
-
269
-
```shell
270
-
docker exec -it myapp-wordpress bash
271
-
```
272
-
273
-
Stop
274
-
275
-
```shell
276
-
docker-compose stop
277
-
```
278
-
279
-
Down (stop and remove)
280
-
281
-
```shell
282
-
docker-compose down
283
-
```
284
-
285
-
Cleanup
286
-
287
-
```shell
288
-
docker-compose rm -v
289
-
```
290
-
291
-
Recreate
292
-
293
-
```shell
294
-
docker-compose up -d --force-recreate
295
-
```
296
-
297
-
Rebuild docker container when Dockerfile has changed
0 commit comments