Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d3a88da3d7 | |||
| 540a332ea7 | |||
| 5f074f02ce | |||
| a4a100b19d | |||
| 6123a72a4b | |||
| 791c7ec143 | |||
| 8c79869804 | |||
| 4e8d58a33c | |||
| a298e99ae6 |
@@ -1,7 +1,7 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name decimus.local;
|
||||
server_name wptest.local;
|
||||
|
||||
location / {
|
||||
access_log off;
|
||||
@@ -14,14 +14,14 @@ server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
|
||||
server_name decimus.local;
|
||||
server_name wptest.local;
|
||||
|
||||
access_log /var/log/nginx/wordpress-443-access.log main;
|
||||
error_log /var/log/nginx/wordpress-443-error.log debug;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/nginx/decimus.local.pem;
|
||||
ssl_certificate_key /etc/nginx/decimus.local-key.pem;
|
||||
#ssl on;
|
||||
ssl_certificate /etc/nginx/wptest.local.pem;
|
||||
ssl_certificate_key /etc/nginx/wptest.local-key.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://wordpress;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7XAYhX/v2Yf40
|
||||
BK58AOxYHZ0C48X+bylulajc9u3zY1FomC/vZsfCy4upBNxhEx5v4S5LK+zcqwRc
|
||||
+bBvpPMBQbdmyPuZIBrlUlqRQRcVyJB4w2kovT291zv5veyHn5Tqv2VnoXXIpKVP
|
||||
MLpMCxc1dAePKhPCuAh5AGPXukn963zKbj9YjGqxE1LKs8OAUrXt2WMEBomiqKfe
|
||||
/usgrv1swJ3mO1GAECz3NDiKwdmA77oiEhWmz6CrxJjatKPZlqEnSMKd1vUP1QvG
|
||||
zpzqzdfTifq20rz82fMk5OcCye+Q0k04h3x95JkC2Ej/Ra4i1kRj1etCpKFkRpJi
|
||||
z+rZbz1NAgMBAAECggEAOIcaPmWUQpDsPkuPTVCF/kvo/F82dH6bdIbo7Mn/nug/
|
||||
Ppx0EfnjmU0KNROHXi6Dh2PcMMfu7eEXLuoSpoyQ2Lc4G2XWKyv5kWjYdGy8B1F8
|
||||
7UKf7q+x+h3/NWls/LpUFsNqV+rp+4BZc9wSyTCrbvAz+6jJT31w6PkKJqNJAbfP
|
||||
xfD9Pbvja9REtTGK8V3F24MvQjUq1jvcTntOanXhSsUvsSpmmJv3UT4vMHkGLpBF
|
||||
hKWx3cxYzMN6tdxH5WQ7u7nKZSjhgoVRfS6Gr8c/jxmr9l+mtom81t+t26NgjQPe
|
||||
aw4Y5XcR7tgmYc+jLlsfF1OPFFmPTtq/IaX+VTsZYQKBgQDZ5dp85Ycc5PGDYuVb
|
||||
xLbHh5rsGSSAwKj9LHfUFkMnlOGL9+nIdErB7GnAcZx4ftP5Bz/hLAvjYMTDuOob
|
||||
Xvq2ndSVuvepzlY6CZpc6WfquhG+zVrzVzW9Q+bZHZ1Up4yRHYY8iiRV7ig9X1/b
|
||||
WaxCptEu/FWA72BqamoEU5fk2QKBgQDcHyBZHdP/+hkGcy7y5pi+T4wmMC60uPKl
|
||||
6l918eIH/cYaMxDKbY1b2kj+eqI+aAirYX7pHzbHPBtTYuAlDPWs/NfaMdhVMaM5
|
||||
2hn7fHxR7QHBdYvDgfrOxkAPsNOhmYbW4XmUUfQVYRLXM/Ii0uwTZGazIqHI1trd
|
||||
2ArBE8yDlQKBgBab0t/CsRI+bxDC4ilzb8OkPl7g/PifBOnAA27uIGmq+Pwc7RTv
|
||||
fBJDBXYCU8ns3vGn3ujuOQ2OrNviA+hzInBwT+55R9lGn4vGE04wqaehRtYVWKqH
|
||||
EfxhX0KH4Bs4h01HUvZVHxALdgFoM/n+g/Emfe3yIK0QKWDhSb7JLamBAoGBAJxP
|
||||
Fh9ySPr61A56eJpQGaL6xeDQUjpPIy+icMtGSmW2VZiBLqkwhjL1nOPonZGHOrDI
|
||||
eOB+I93y1syt59EnlMWUfosY3jARIYGRWOX2jil3Dcoc+HSKtlli+laqEH4ukUvB
|
||||
rR4f3B3aYxCieI02DiHvJ+aI7y25NI5YPbrBnnbJAoGARIG/chY3OuaRNpE7jplv
|
||||
RaHJlz4T6zSYoK9zkM5viiS6urF+pwzGFrRlPS33gGdOUbOHVYm4v6bKqinDHfFt
|
||||
dQzZlMpxDkdyfFQb1n/Q06h9ZZ09tSqEU01MgScuSq88y4Ivotx5bDWDDJwDiCSZ
|
||||
CuT8NDdAi+qV2AUYs94GBbU=
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -1,25 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIESzCCArOgAwIBAgIRAJMLuz/97qw1rm2WJ2/fxyQwDQYJKoZIhvcNAQELBQAw
|
||||
gYUxHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTEtMCsGA1UECwwkcm9v
|
||||
dEBndWxhY3NpLUxlbm92by1MZWdpb24tNS0xNUlNSDA1MTQwMgYDVQQDDCtta2Nl
|
||||
cnQgcm9vdEBndWxhY3NpLUxlbm92by1MZWdpb24tNS0xNUlNSDA1MB4XDTIxMTIx
|
||||
MjAwNDAzMloXDTI0MDMxMjAwNDAzMlowWDEnMCUGA1UEChMebWtjZXJ0IGRldmVs
|
||||
b3BtZW50IGNlcnRpZmljYXRlMS0wKwYDVQQLDCRyb290QGd1bGFjc2ktTGVub3Zv
|
||||
LUxlZ2lvbi01LTE1SU1IMDUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
|
||||
AQC7XAYhX/v2Yf40BK58AOxYHZ0C48X+bylulajc9u3zY1FomC/vZsfCy4upBNxh
|
||||
Ex5v4S5LK+zcqwRc+bBvpPMBQbdmyPuZIBrlUlqRQRcVyJB4w2kovT291zv5veyH
|
||||
n5Tqv2VnoXXIpKVPMLpMCxc1dAePKhPCuAh5AGPXukn963zKbj9YjGqxE1LKs8OA
|
||||
UrXt2WMEBomiqKfe/usgrv1swJ3mO1GAECz3NDiKwdmA77oiEhWmz6CrxJjatKPZ
|
||||
lqEnSMKd1vUP1QvGzpzqzdfTifq20rz82fMk5OcCye+Q0k04h3x95JkC2Ej/Ra4i
|
||||
1kRj1etCpKFkRpJiz+rZbz1NAgMBAAGjYjBgMA4GA1UdDwEB/wQEAwIFoDATBgNV
|
||||
HSUEDDAKBggrBgEFBQcDATAfBgNVHSMEGDAWgBS4r/m19u5yw4pIZNp5X/5ZGkzj
|
||||
BDAYBgNVHREEETAPgg1kZWNpbXVzLmxvY2FsMA0GCSqGSIb3DQEBCwUAA4IBgQCF
|
||||
EW4vysyvTJHQ1GERqHoDVN3QkwIL3aFLiFS8dwjAJ63go1slYIu8absUEbF8ITxf
|
||||
kP1VpL/jrSp9UKmwHUHht2keNJpFFk3jUGkWlZlI9iz7yNq4dRmAnDCUOAsw60+A
|
||||
fwnQ/NkENO077yPia2wUJTuWRVHC8dzvjynpjrTvC822Ey2HNCnuquOdMMz1dD8N
|
||||
spBkCiX/JHDwCHfjvZUWEgzaMSzczACQSyFKaUbJ+Kpx6T5zAsNuuimzotDXw1pU
|
||||
k7yTNXupw/wCvuGa/dzG4afxs9mP5Mxr+LqEP38IGRZDiDYWYlnNtOa+58szXYb9
|
||||
QA5nVI4/cnVCmHQlObuy2PG8CX6g7BTuMoxo3GF5QliWc8UAonTVKftPPWf2Skc+
|
||||
BHDtP7HiS0r35vdjPgxWT6sbfwpTxeQz9BGGfvAlULQRVIvKuu9pSDS2clah6epe
|
||||
EDvNrGC7+hoNuKEW20U9h7U4jr03uuYT9aUg9VVjhjz48YaY4D2NICmYDEpTdW4=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -3,15 +3,14 @@
|
||||
# Docker Hub: https://registry.hub.docker.com/u/conetix/wordpress-with-wp-cli/
|
||||
# Github Repo: https://github.com/conetix/docker-wordpress-wp-cli
|
||||
|
||||
FROM wordpress:php8.0-apache
|
||||
FROM wordpress:php8.2-apache
|
||||
ARG BASEDIR
|
||||
# required build arg for apache2 configuration
|
||||
ARG SERVER_NAME
|
||||
|
||||
# Install sudo in order to run wp-cli as the www-data user
|
||||
# install mysql client, text editors
|
||||
RUN apt-get update && apt-get install -y sudo less \
|
||||
default-mysql-client nano vim
|
||||
RUN apt-get update && apt-get install -y sudo less default-mysql-client nano vim unzip
|
||||
|
||||
# Install WP-CLI
|
||||
RUN curl -o /bin/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
# Docker Hub: https://registry.hub.docker.com/u/conetix/wordpress-with-wp-cli/
|
||||
# Github Repo: https://github.com/conetix/docker-wordpress-wp-cli
|
||||
|
||||
FROM wordpress:php8.0-apache
|
||||
FROM wordpress:php8.2-apache
|
||||
ARG BASEDIR
|
||||
|
||||
# Install sudo in order to run wp-cli as the www-data user
|
||||
# install mysql client, text editors
|
||||
RUN apt-get update && apt-get install -y sudo less \
|
||||
default-mysql-client nano vim
|
||||
RUN apt-get update && apt-get install -y sudo less default-mysql-client nano vim unzip
|
||||
|
||||
# Install WP-CLI
|
||||
RUN curl -o /bin/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
# App
|
||||
APP_NAME=decimus
|
||||
APP_NAME=wptest
|
||||
APP_DOMAIN="${APP_NAME}.local"
|
||||
APP_LOCALE=en_GB
|
||||
|
||||
@@ -12,7 +12,7 @@ DB_HOST=localhost
|
||||
DB_CHARSET=utf8
|
||||
|
||||
# Email
|
||||
ADMIN_EMAIL=johndoe@mail.local
|
||||
ADMIN_EMAIL=johndoe@wptest.local
|
||||
|
||||
# Ports
|
||||
MYSQL_PORT=3306
|
||||
+10
-4
@@ -2,8 +2,8 @@
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
# Only test credentials inside
|
||||
#.env
|
||||
# Environment files
|
||||
.env
|
||||
|
||||
### Composer
|
||||
src/composer.phar
|
||||
@@ -19,12 +19,19 @@ db/*
|
||||
|
||||
### Docker
|
||||
ntunnel-*.php
|
||||
/.docker/images/nginx/ssl/*.pem
|
||||
|
||||
### Wordpress
|
||||
/src/index.php
|
||||
/src/.htaccess
|
||||
/src/wp-config.php
|
||||
src/wp
|
||||
src/wp-content/themes/*
|
||||
|
||||
# exceptions
|
||||
!src/wp-content/themes/decimus
|
||||
!src/wp-content/themes/decimus-child
|
||||
|
||||
src/wp-content/plugins/*
|
||||
|
||||
src/wp-content/backups-dup-lite/*
|
||||
@@ -36,6 +43,5 @@ src/wp-content/uploads/*
|
||||
# wordfence logs
|
||||
src/wp-content/wflogs/*
|
||||
|
||||
# woocommerce logs
|
||||
src/wp-content/uploads/wc-logs/
|
||||
/src/index.php
|
||||
/src/wp-config.php
|
||||
|
||||
@@ -14,17 +14,22 @@ now._
|
||||
|
||||
The following Docker images are included:
|
||||
|
||||
- [wordpress:php8.0-apache](https://hub.docker.com/_/wordpress)
|
||||
- [wordpress:php8.2-apache](https://hub.docker.com/_/wordpress)
|
||||
- [nginx:latest](https://hub.docker.com/_/nginx)
|
||||
- [mysql:8.0](https://hub.docker.com/_/mysql)
|
||||
- [phpmyadmin/phpmyadmin](https://hub.docker.com/r/phpmyadmin/phpmyadmin)
|
||||
- [sj26/mailcatcher](https://hub.docker.com/r/sj26/mailcatcher)
|
||||
- [sj26/mailcatcher:v0.10.0](https://hub.docker.com/r/sj26/mailcatcher)
|
||||
|
||||
|
||||
Change your docker PHP version in: `.docker/images/wordpress/Dockerfile`, or `.docker/images/wordpress/Dockerfile-ssl`.
|
||||
It works with 8.0, 8.1 as well. WordPress 6.6 [already supports PHP 8.2]((https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/)) (with possible exceptions)
|
||||
|
||||
**Project structure:**
|
||||
|
||||
- `.docker`: contains all docker-specific files and folders
|
||||
- `src`: the source code goes here
|
||||
|
||||
|
||||
## Install a new, or setup an existing WordPress site
|
||||
|
||||
### HTTPS install
|
||||
@@ -39,28 +44,21 @@ bin/setup-ssl
|
||||
```
|
||||
|
||||
You may need to make scripts in the `bin` folder, and the `.docker/images/nginx/ssl/mkcert-v1.4.3-linux-amd64`
|
||||
executable. For Mac or Windows you will need a different mkcert executable / installer. Links:
|
||||
|
||||
- Windows: https://github.com/FiloSottile/mkcert#windows
|
||||
- Mac: https://github.com/FiloSottile/mkcert#macos
|
||||
- Linux: https://github.com/FiloSottile/mkcert#linux or use pre-build
|
||||
binaries: https://github.com/FiloSottile/mkcert/releases
|
||||
executable (https://github.com/FiloSottile/mkcert/releases).
|
||||
|
||||
The supplied mkcert version is for Debian/Ubuntu.
|
||||
|
||||
3. Modify `.docker/images/nginx/conf.d/default.conf`:
|
||||
Change `server_name` to your custom domain! It is not automatically rewritten because the nginx container gets the
|
||||
file
|
||||
from volume binding.
|
||||
3. Modify `.docker/images/nginx/conf.d/default.conf`: Change `server_name` to your custom domain (`${APP_NAME}.local`)!
|
||||
|
||||
3. Add domain alias for 127.0.0.1 (e.g. `nano /etc/hosts` for Linux)
|
||||
4. Build docker project (on Linux make sure to configure Docker so that you can run it without sudo privileges):
|
||||
4. Add domain alias for 127.0.0.1 (e.g. `nano /etc/hosts` for Linux)
|
||||
|
||||
5. Build docker project (on Linux make sure to configure Docker so that you can run it without sudo privileges):
|
||||
|
||||
```shell
|
||||
(set -a;source .env;docker-compose -f docker-compose-ssl.yml up --build)
|
||||
```
|
||||
|
||||
With sudo privileges:
|
||||
With sudo privileges (not recommended):
|
||||
|
||||
```bash
|
||||
set -a
|
||||
@@ -70,13 +68,14 @@ sudo -E docker-compose up --build
|
||||
|
||||
5. WordPress database installation with wp-cli, import db for existing sites
|
||||
|
||||
- For a new site run (it will set up your database and configure your site automatically):
|
||||
- For a new site run this command (it will set up your database and configure your site automatically):
|
||||
|
||||
```shell
|
||||
bin/setup-wp
|
||||
```
|
||||
|
||||
- For an existing site, import sql dump or use PhpMyAdmin (however, the latter is not suitable for importing large db dumps):
|
||||
- For an existing site, import sql dump or use PhpMyAdmin (however, the latter is not suitable for importing large
|
||||
database sql dumps):
|
||||
|
||||
```shell
|
||||
bin/mysql-import
|
||||
@@ -93,8 +92,10 @@ Make sure to have the correct database name in the comments of the sql dump. Exa
|
||||
--
|
||||
-- Current Database: `testdbname`
|
||||
--
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testdbname` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
|
||||
USE `testdbname`;
|
||||
CREATE
|
||||
DATABASE /*!32312 IF NOT EXISTS*/ `testdbname` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
|
||||
USE
|
||||
`testdbname`;
|
||||
```
|
||||
|
||||
For existing sites, replace domain in database tables (enter container first with bash):
|
||||
@@ -104,7 +105,7 @@ bin/bash
|
||||
wp search-replace 'https://example.com' 'https://example.local' --skip-columns=guid
|
||||
```
|
||||
|
||||
Add your themes, plugins and other assets to `src\wp-content/`
|
||||
**Add your themes, plugins and other assets to `src\wp-content/`**
|
||||
|
||||
No need to change any additional files. The `wp-config.php` loads all credentials from the `.env` file. Every bash
|
||||
script in bin folder loads environment variables from `.env`.
|
||||
@@ -116,14 +117,16 @@ bin/bash
|
||||
wp user create username name@example.com --role=administrator --user_pass=Password123!
|
||||
```
|
||||
|
||||
|
||||
### HTTP install
|
||||
|
||||
Installation is almost the same as for https. We just need to use another docker-compose file
|
||||
Installation is almost the same as for https. We just need to use another docker-compose file for the build:
|
||||
|
||||
```shell
|
||||
(set -a;source .env;docker-compose -f docker-compose.yml up --build)
|
||||
```
|
||||
|
||||
|
||||
## Configure WordPress local site
|
||||
|
||||
1. Install/update composer packages (composer.json is in the `/src` folder). Run
|
||||
@@ -132,7 +135,7 @@ Installation is almost the same as for https. We just need to use another docker
|
||||
bin/composer update
|
||||
```
|
||||
|
||||
_! NOTICE: Installing or updating WordPress with composer returns an non-breaking error. However, plugins and themes are
|
||||
_! NOTICE: Installing or updating WordPress with composer returns a non-breaking error. However, plugins and themes are
|
||||
installed properly despite the error. Need to be resolved. -> error DISAPPEARED (2023-01-25)_
|
||||
|
||||
2. Add/update `wp-config.php` constants, values etc. (optional, not needed generally)
|
||||
@@ -156,6 +159,7 @@ wp config set FS_METHOD "'direct'" --type=constant --add --raw
|
||||
wp config set "DISALLOW_FILE_MODS" true --type=constant --add --raw
|
||||
```
|
||||
|
||||
|
||||
## Customisations made to `wordpress` image
|
||||
|
||||
- wp-cli, and composer 2 was installed. (The official image does not have it. There is a `wordpress:cli` image, but it
|
||||
@@ -165,6 +169,7 @@ wp config set "DISALLOW_FILE_MODS" true --type=constant --add --raw
|
||||
`sendmail_path = /usr/bin/env catchmail -f wordpress@local.test`
|
||||
- upload_max_filesize = 20M
|
||||
|
||||
|
||||
## Composer
|
||||
|
||||
Core, plugins and themes are installed/handled/updated/deleted with composer to keep track of the dependency versions.
|
||||
@@ -184,14 +189,9 @@ wp config set "DISALLOW_FILE_MODS" true --type=constant --add --raw
|
||||
Update packages:
|
||||
|
||||
```bash
|
||||
composer update
|
||||
bin/composer update
|
||||
```
|
||||
|
||||
Install packages (from [WPackagist](https://wpackagist.org/)):
|
||||
|
||||
```bash
|
||||
composer install packagename
|
||||
```
|
||||
|
||||
## MySQL database management, PhpMyAdmin
|
||||
|
||||
@@ -235,6 +235,7 @@ WHERE option_name = 'OLDPREFIX_user_roles';
|
||||
|
||||
PhpMyAdmin service is accessible here: `http://localhost:1337`
|
||||
|
||||
|
||||
## Manage docker containers / Development
|
||||
|
||||
Make sure the host ports that are bound to our container's internal ports are not in use by another container or host
|
||||
@@ -262,7 +263,8 @@ docker-compose down
|
||||
|
||||
## Bash scripts in `bin` folder
|
||||
|
||||
Useful and makes it faster to run common tasks. Check them out.
|
||||
Useful and makes it faster to run some common tasks. Check them out.
|
||||
|
||||
|
||||
## Useful WP CLI commands
|
||||
|
||||
@@ -355,28 +357,82 @@ wp theme activate
|
||||
wp theme get twentysixteen --fields=name,title,version
|
||||
```
|
||||
|
||||
|
||||
## Deployment on shared hosting
|
||||
|
||||
1. Create a new MySQL database
|
||||
2. Update `wp-config` with the new database credentials (dbname, username, password). The host is `"localhost"` most of
|
||||
2. Update `wp-config` with the new database credentials (database name, username, password). The host is `"localhost"`
|
||||
most of
|
||||
the time.
|
||||
3. Export your local database with PhpMyAdmin, or create a sql dump with MySQL in the terminal (for larger databases,
|
||||
the latter is recommended). After that, import it into your live database.
|
||||
4. You have to rewrite urls and some options with your live domain name (see `src/data/rewrite-domainname.sql`). Or you
|
||||
can also use the `wp-cli` locally, and then export your local db.
|
||||
4. You have to rewrite the urls and some options with your live domain name (see `src/data/rewrite-domainname.sql`). Or,
|
||||
you
|
||||
can also use the `wp-cli` locally, and then export your local database (and rewrite them back to the local ones
|
||||
afterward).
|
||||
5. Copy the content of the `src/` folder to your host through SFTP.
|
||||
6. Post-deployment: Setup SMTP, increase security (use WordFence firewall), make a backup (e.g. with Duplicator), etc.
|
||||
6. Post-deployment: Setup SMTP, increase security (use WordFence firewall), etc.
|
||||
|
||||
Change your salts occasionally (https://api.wordpress.org/secret-key/1.1/salt/).
|
||||
Occasionally, change your [salts](https://api.wordpress.org/secret-key/1.1/salt/) used for hashing.
|
||||
|
||||
|
||||
## Gitignore
|
||||
## Update .gitignore file!
|
||||
|
||||
Make sure you never commit the .env file and wp-config.php to version control (even if it is a private repo - you may change the visibility of the repo in the future, and then it will become a vulnerability).
|
||||
It also applies to your ssl cert keys you generated with mkcert! The cert in the git repo is just an example (I already generated new cert for my local project).
|
||||
Make sure you NEVER commit the .env file and wp-config.php to version control. It also applies to your ssl
|
||||
certificate keys you generated with mkcert!
|
||||
|
||||
Update .gitignore!
|
||||
These ignore rules are already added to `.gitignore`.
|
||||
|
||||
**Good tip: Set up GitGuardian** to get notification about potential credential leaks! I am certain that everyone has
|
||||
pushed sensitive information by accident at least one time in his/her developer life by not paying attention enough.
|
||||
**Good tip: Set up GitGuardian** to get notification about potential credential leaks.
|
||||
|
||||
|
||||
## Mailcatcher for local e-mail testing
|
||||
|
||||
1. See the `mailcatcher` in the docker-compose files.
|
||||
|
||||
2. Install `"wpackagist-plugin/wp-mail-smtp":"4.0.1"` with Composer inside the WordPress service if you don't have it:
|
||||
`bin/composer require "wpackagist-plugin/wp-mail-smtp":"4.0.1"`.
|
||||
|
||||
3. Configure SMTP:
|
||||
|
||||
Setup "from address", and "name". Choose the "Other SMTP" option.
|
||||
Set these:
|
||||
|
||||
- SMTP Host: **mailcatcher**
|
||||
- SMTP Port: **1025**
|
||||
|
||||
No need for encryption.
|
||||
Auto TLS -> Off.
|
||||
Authentication -> None.
|
||||
|
||||
4. Send out a test email (Tools menu point under WP Mail SMTP).
|
||||
|
||||
5. Access Mailcatcher UI at `localhost:1080`
|
||||
|
||||
Generally, there is no need to configure anything else if you followed the instructions, or you didn't make other
|
||||
changes. See the PHP section on the [mailcatcher website](https://mailcatcher.me/), or in
|
||||
the [PHP documentation](https://www.php.net/manual/en/mail.configuration.php#ini.sendmail-path) for more info.
|
||||
|
||||
This is the `php.ini` file location inside the **wordpress** container: `/usr/local/etc/php`. This file is copied here
|
||||
from `.docker/images/wordpress/php.ini-development`.
|
||||
|
||||
This is the default setting for `sendmail_path`:
|
||||
`sendmail_path = /usr/bin/env catchmail -f wordpress@local.test`
|
||||
|
||||
### Possible issues with catchmail
|
||||
|
||||
**/usr/bin/env: 'catchmail': No such file or directory**
|
||||
|
||||
You can try to change the setting to this ([source](https://wesamly.wordpress.com/2015/10/27/mailcatcher-error-env-catchmail-no-such-file-or-directory/)):
|
||||
`sendmail_path = /usr/bin/env /usr/local/bin/catchmail -f some@example.com`
|
||||
|
||||
Or you can use mhsendmail as an alternative with this setting:
|
||||
`sendmail_path = /usr/local/bin/mhsendmail`
|
||||
|
||||
[msendmail install instructions.](https://github.com/SalsaBoy990/docker-wordpress/issues/4#issuecomment-2016944122)
|
||||
|
||||
|
||||
## License, credits
|
||||
|
||||
MIT License
|
||||
Copyright (c) 2021-2023 András Gulácsi
|
||||
|
||||
@@ -40,6 +40,14 @@ services:
|
||||
- WORDPRESS_DEBUG=true
|
||||
volumes:
|
||||
- ./src:/var/www/html:cached
|
||||
# Point the IP of the Nginx container to the WordPress site URL to make the loopback work
|
||||
# https://devops.stackexchange.com/questions/12957/wordpress-site-health-errors-when-using-docker-and-nginx
|
||||
# Use the bridge network's IP address instead:
|
||||
# 172.17.0.1 -> docker network inspect -v bridge
|
||||
extra_hosts:
|
||||
- localhost:172.17.0.1
|
||||
- wptest.local:172.17.0.1
|
||||
- host.docker.internal:host-gateway
|
||||
|
||||
|
||||
nginx:
|
||||
@@ -73,7 +81,7 @@ services:
|
||||
|
||||
|
||||
mailcatcher:
|
||||
image: sj26/mailcatcher
|
||||
image: sj26/mailcatcher:v0.10.0
|
||||
container_name: "${APP_NAME}-mailcatcher"
|
||||
ports:
|
||||
- "1080:1080"
|
||||
|
||||
+8
-2
@@ -41,8 +41,14 @@ services:
|
||||
- WORDPRESS_DB_PASSWORD=${DB_PASSWORD} # matches the password set in the db container
|
||||
- WORDPRESS_DB_NAME=${DB_NAME}
|
||||
- WORDPRESS_DEBUG=true
|
||||
# Point the IP of the Nginx container to the WordPress site URL to make the loopback work
|
||||
# https://devops.stackexchange.com/questions/12957/wordpress-site-health-errors-when-using-docker-and-nginx
|
||||
# Use the bridge network's IP address instead:
|
||||
# 172.17.0.1 -> docker network inspect -v bridge
|
||||
extra_hosts:
|
||||
- "${APP_NAME}.local:127.0.0.1"
|
||||
- localhost:172.17.0.1
|
||||
- "${APP_NAME}.local:127.0.0.1"
|
||||
- host.docker.internal:host-gateway
|
||||
hostname: ${APP_NAME}.local
|
||||
domainname: local
|
||||
volumes:
|
||||
@@ -62,7 +68,7 @@ services:
|
||||
|
||||
|
||||
mailcatcher:
|
||||
image: sj26/mailcatcher
|
||||
image: sj26/mailcatcher:v0.10.0
|
||||
container_name: "${APP_NAME}-mailcatcher"
|
||||
ports:
|
||||
- "1080:1080"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# BEGIN WordPress
|
||||
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
|
||||
# dynamically generated, and should only be modified via WordPress filters.
|
||||
# Any changes to the directives between these markers will be overwritten.
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
RewriteBase /
|
||||
RewriteRule ^index\.php$ - [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.php [L]
|
||||
</IfModule>
|
||||
|
||||
# END WordPress
|
||||
+6
-6
@@ -6,13 +6,13 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"johnpbloch/wordpress": "6.3.2",
|
||||
"johnpbloch/wordpress": "6.6.1",
|
||||
"wpackagist-plugin/regenerate-thumbnails": "3.1.6",
|
||||
"wpackagist-plugin/wp-mail-smtp": "3.9.0",
|
||||
"wpackagist-plugin/woocommerce": "8.2.1",
|
||||
"wpackagist-theme/twentytwenty":"2.3",
|
||||
"wpackagist-theme/twentytwentyone":"1.9",
|
||||
"wpackagist-theme/twentytwentythree":"1.2",
|
||||
"wpackagist-plugin/wp-mail-smtp": "4.1.1",
|
||||
"wpackagist-plugin/woocommerce": "9.2.2",
|
||||
"wpackagist-theme/twentytwenty":"2.7",
|
||||
"wpackagist-theme/twentytwentyone":"2.3",
|
||||
"wpackagist-theme/twentytwentythree":"1.5",
|
||||
"wpackagist-theme/highstarter":"2.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
Reference in New Issue
Block a user