Update README.md

This commit is contained in:
2025-06-20 13:48:47 +00:00
parent 8733a44f38
commit a755a45749

141
README.md
View File

@@ -1,7 +1,7 @@
<p align="center"> <p align="center">
<a href="https://tip.jhammah.com"> <a href="https://tip.jhammah.com">
<picture> <picture>
<img src="https://user-images.githubusercontent.com/1128849/210187356-dfb7f1c5-ac2e-43aa-bb23-fc014280ae1f.svg" alt="Caddy" width="500"> <img src="https://jhammah.com/wp-content/uploads/2025/06/wordpress-logo-scaled.png" alt="Caddy" width="500">
</picture> </picture>
</a> </a>
</p> </p>
@@ -15,7 +15,7 @@
<br> <br>
<h1 align="center">Install Caddy with packages (xcaddy) inside Docker Desktop </h1> <h1 align="center">How to efficially install, host, and maintain lightning fast Wordpress websites inside Docker Desktop. </h1>
<br> <br>
@@ -24,12 +24,14 @@
# Navigation # Navigation
- [Prerequisite](#prerequisite) - [Prerequisite](#prerequisite)
- [Install](#install) - [Creating a Custom Network](#creating-a-custom-network)
- [Configuring docker-compose.yml file](#configuring-docker-composeyml-file) - [Folder Organization](#folder-organization)
- [Configuring .env file](#configuring-env-file) - [Configuring .env file](#configuring-env-file)
- [Configuring dockerfile.caddy file](#configuring-dockerfilecaddy-file) - [Configuring docker-compose.yml file](#configuring-docker-composeyml-file)
- [Configuring Caddyfile](#configuring-caddyfile) - [Execute and Test](#execute-and-test)
- [Execute and finish](#execute-and-finish) - [Reverse Proxy Steps](#reverse-proxy-steps)
- [wp-config.php configuration](#wp-configphp-configuration)
- [Caddyfile Configuration](#caddyfile-configuration)
<br> <br>
@@ -37,52 +39,21 @@
# Prerequisite # Prerequisite
- **If you have Cloudflare managing your domain, make the the TLS/SSL encryption mode is set to Full (Strict) and NOT Flexible.** - **If you are using Cloudflare to host your domain, you NEED to make sure that it's SSL/TLS encryption mode is set to Full (strict). Be default, domains are set to Flexible and you'll get thrown in an infinite loop when using a reverse proxy.**
- **When adding CNAME entries to your domains, make sure Cloudflare's proxy is disabled for each CNAME record.** - **For these instructions we'll be using the example domain called " website.com " and will be changing things to " wp-website-com " in the appropriate locations in the files.**
- **For very nice organization, I recommend keeping the ' wp- ' part at the beginning of the naming scheme so you can easily filter out containers and find what you're looking for very quickly and neatly.**
- **The password to extract all of the tutorial files from the zip file is: JHammaH**
<br> <br>
<br> <br>
# Install # Creating a Custom Network
<h4> This tutorial will show you how to install Caddy with with packages automatically with xcaddy as a Docker container. Installing extra packages is optional but it's good to have a few of them. </h4> * **Creating a Custom Network**
<br>
<br>
<h3> 1⃣ </h3>
## Configuring docker-compose.yml file
* **This is the main Caddy docker-compose.yml file that you will use to create your container.**
* **Instead of specifying an image under the caddy services, we're going to specify a Docker file In which we Tell it how to build a custom caddy image for us.**
* **If you DO NOT want to build a custom caddy image and just use the default caddy image, you can delete this section that says:**
```yml
build:
context: .
dockerfile: dockerfile.caddy
```
**and replace it with:**
```yml
image: caddy:latest
```
* **It's always going to restart unless we manually stop it.**
* **We're telling it that it has env file to reference.**
* **We are mapping it to ports 80 and 443.**
* **We are creating five volumes for it.**
* **And finally we are creating a custom caddy Network.**
<p align="center"> <p align="center">
<a href="https://tip.jhammah.com"> <a href="https://tip.jhammah.com">
@@ -96,7 +67,21 @@ image: caddy:latest
<br> <br>
<h3> 2⃣ </h3> ## Folder Organization
* **Folder Organization**
<p align="center">
<a href="https://tip.jhammah.com">
<picture>
<img src="https://jhammah.com/wp-content/uploads/2025/05/caddy_yml_1.png" alt="Docker" width="1280">
</picture>
</a>
</p>
<br>
<br>
## Configuring .env file ## Configuring .env file
@@ -114,17 +99,33 @@ image: caddy:latest
<br> <br>
<h3> 3⃣ </h3> ## Configuring docker-compose.yml file
## Configuring dockerfile.caddy file * **Configuring docker-compose.yml file**
* **This is the dockerfile.caddy file that your docker-compose.yml file will use to create your custom Caddy image.** ```yml
code
```
* **Inside this file, we're going to give it some commands to create the image from caddy:builder, include some GitHub packages, attach them to the caddy:latest.** <p align="center">
<a href="https://tip.jhammah.com">
<picture>
<img src="https://jhammah.com/wp-content/uploads/2025/05/caddy_yml_1.png" alt="Docker" width="1280">
</picture>
</a>
</p>
* **And then once it's built, copy it to a specific directory** <br>
* **When you launch the docker-compose.yml file, it will trigger this file to build your custom image automatically.** <br>
## Execute and Test
* **Execute and Test**
```ps1
docker-compose up -d
```
<p align="center"> <p align="center">
<a href="https://tip.jhammah.com"> <a href="https://tip.jhammah.com">
@@ -138,20 +139,10 @@ image: caddy:latest
<br> <br>
<h3> 4⃣ </h3> ## Reverse Proxy Steps
## Configuring Caddyfile
* **This is the Caddyfile. This file tells Caddy what and how to do things.** * **This is the Caddyfile. This file tells Caddy what and how to do things.**
* **Inside of the Caddyfile, I've organized it into three sections. Global, Snippets, and Sites.**
* **In the Global section, you're going to specify some default parameters .**
* **In the Snippets section, you're going to be creating variables and functions that you can import into your websites.**
* **Under the Site section, you will list your websites as well as commands for Caddy to perform on your website.**
<p align="center"> <p align="center">
<a href="https://tip.jhammah.com"> <a href="https://tip.jhammah.com">
<picture> <picture>
@@ -164,22 +155,32 @@ image: caddy:latest
<br> <br>
# Execute and finish # wp-config.php configuration
**Once you have all of the files customized to your liking and all four of them are sitting in the same directory, you'll be ready to launch the yml file.** **wp-config.php configuration**
**You can do this by right-clicking in an empty space in the folder where all your files are located and selecting 'Open in Terminal'.** ```php
docker-compose up -d
```
**That opens a Powershell window inside that direcotry where you can enter this code to launch everything.** <br>
<br>
# Caddyfile configuration
**wp-config.php configuration**
```ps1 ```ps1
docker-compose up -d docker-compose up -d
``` ```
**And that's it! Caddy should be live ina Docker container and actively acting as a reverse proxy!** <br>
<br> <br>
<H1 align="center">Support the channel so I can make more tutorials!</h1> <H1 align="center">Support the channel so I can make more tutorials!</h1>
<H1 align="center"><a href="https://tip.jhammah.com">If this tutorial helped you out, feel free to buy me a coffee!</h1> <H1 align="center"><a href="https://tip.jhammah.com">If this tutorial helped you out, feel free to buy me a coffee!</h1>
<br>