@@ -95,13 +95,12 @@ Once logged in, navigate to the Coolify proxy directory:
9595$ cd /data/coolify/proxy
9696```
9797
98- Check if you have a ** certs** folder:
99- ``` sh
100- $ ls
101- > acme.json docker-compose.yml dynamic
102- ```
98+ Adding certificates slightly varies for Caddy and Traefik proxy so choose the correct one from the below section
10399
104- If there’s no ** certs** folder, create it:
100+ ::: tabs
101+
102+ == Traefik
103+ Create the ` certs ` directory:
105104``` sh
106105$ mkdir certs
107106```
@@ -140,6 +139,48 @@ $ nano shadowarcanist.key
140139```
141140Save and exit.
142141
142+ == Caddy
143+ Create the ` caddy/data/certs ` directory:
144+ ``` sh
145+ $ mkdir -p caddy/data/certs
146+ ```
147+
148+ Verify it was created:
149+ ``` sh
150+ $ ls caddy/data
151+ > certs
152+ ```
153+
154+ Now, navigate into the ** certs** directory:
155+ ``` sh
156+ $ cd caddy/data/certs
157+ ```
158+
159+ Create two new files for the certificate and private key:
160+ ``` sh
161+ $ touch shadowarcanist.cert shadowarcanist.key
162+ ```
163+
164+ Verify the files were created:
165+ ``` sh
166+ $ ls
167+ > shadowarcanist.cert shadowarcanist.key
168+ ```
169+
170+ Open the ** shadowarcanist.cert** file and paste the certificate from the Cloudflare dashboard:
171+ ``` sh
172+ $ nano shadowarcanist.cert
173+ ```
174+ Save and exit after pasting the certificate.
175+
176+ Do the same for the ** shadowarcanist.key** file and paste the private key:
177+ ``` sh
178+ $ nano shadowarcanist.key
179+ ```
180+ Save and exit.
181+
182+ :::
183+
143184Now the origin certificate is installed on your server.
144185
145186
@@ -183,15 +224,6 @@ Finally, enable HTTP to HTTPS redirects:
183224
184225
185226## 4. Configure Coolify proxy to Use the Origin Certificate
186-
187- ::: warning
188- In this step, we're focusing on configuring Traefik (Coolify's proxy) to use the Origin Certificate.
189-
190- If you're using Caddy instead, please refer to their [ official documentation ↗] ( https://caddyserver.com/docs/caddyfile/directives/tls ) .
191- :::
192-
193- Now, in your Coolify dashboard:
194-
195227<ZoomableImage src =" /docs/images/integrations/cloudflare/ddos-protection/8.webp " />
196228
1972291 . Go to the ** Server** section in the sidebar.
@@ -201,9 +233,15 @@ Now, in your Coolify dashboard:
201233
202234You will now be prompted to enter the Dynamic Configuration.
203235
236+ Adding Dynamic Configuration slightly varies for Caddy and Traefik proxy so choose the correct one from the below section
237+
238+ ::: tabs
239+
240+ == Traefik
241+
204242<ZoomableImage src =" /docs/images/integrations/cloudflare/ddos-protection/9.webp " />
205243
206- 1 . Choose a name for your configuration.
244+ 1 . Choose a name for your configuration (must end with ` .yaml ` ) .
2072452 . Enter the following details in the configuration field:
208246``` sh
209247tls:
213251 keyFile: /traefik/certs/shadowarcanist.key
214252```
215253
216- :::details Adding Multiple Certificates (click to view)
217-
254+ 3 . Save the configuration
255+ ---
256+ If you want to add multiple certificates and keys, you can do it like this:
218257``` sh
219258tls:
220259 certificates:
@@ -228,10 +267,41 @@ tls:
228267 certFile: /traefik/certs/name3.cert
229268 keyFile: /traefik/certs/name3.key
230269```
231- :::
270+
271+ == Caddy
272+ <ZoomableImage src =" /docs/images/integrations/cloudflare/ddos-protection/10.webp " />
273+
274+ 1 . Choose a name for your configuration (must end with ` .caddy ` ).
275+ 2 . Enter the following details in the configuration field:
276+ ``` sh
277+ * .shadowarcanist.com, shadowarcanist.com {
278+ tls /data/certs/shadowarcanist.cert /data/certs/shadowarcanist.key
279+ }
280+ ```
281+
282+ > Note: The wildcard ` *.shadowarcanist.com ` provides coverage for all subdomains, exclude it if you’re only securing a single domain (i.e, ` shadowarcanist.com ` ).
232283
2332843 . Save the configuration
234285
286+ ---
287+
288+ If you want to add multiple certificates and keys, you can do it like this:
289+ ``` sh
290+ * .shadowarcanist.com, shadowarcanist.com {
291+ tls /data/certs/shadowarcanist.cert /data/certs/shadowarcanist.key
292+ }
293+
294+ * .name2.com, name2.com {
295+ tls /data/certs/name2.cert /data/certs/name2.key
296+ }
297+
298+ * .name3.com, name3.com {
299+ tls /data/certs/name3.cert /data/certs/name3.key
300+ }
301+ ```
302+ :::
303+
304+
235305From now on, Coolify will use the origin certificate for requests matching the hostname.
236306
237307Now you’re done! Your server is set up to use the Cloudflare Origin Certificate, and all traffic is proxied through Cloudflare network so all incoming attacks like DDoS are prevented by Cloudflare before it reaches your server.
0 commit comments