Cloudflare 2 sites on 1 server/ip

1. The problem I’m having:

I am trying to launch 2 websites on 1 server / 1 ip
they are both laravel sites and instead of launching them the conventional way I just utilized php artisan serve --port --host
I use cloudflare to manage both these sites andto utilize their proxy service

déc. 12 19:38:53 raqo-local caddy[29298]: {"level":"info","ts":1702406333.8257444,"logger":"http.acme_client","msg":"validations succeeded; finalizing order","order":"https://acme-v02.api.letsencrypt.org/acme/order/1461492796/228738121146"}
déc. 12 19:38:54 raqo-local caddy[29298]: {"level":"info","ts":1702406334.4769325,"logger":"http.acme_client","msg":"successfully downloaded available certificate chains","count":2,"first_url":"https://acme-v02.api.letsencrypt.org/acme/cert/03107633dacc26c92cc85b1580cd862e594a"}
déc. 12 19:38:54 raqo-local caddy[29298]: {"level":"info","ts":1702406334.4777806,"logger":"tls.obtain","msg":"certificate obtained successfully","identifier":"mansour.taxi"}
déc. 12 19:38:54 raqo-local caddy[29298]: {"level":"info","ts":1702406334.4780939,"logger":"tls.obtain","msg":"releasing lock","identifier":"mansour.taxi"}
déc. 12 19:39:41 raqo-local caddy[29298]: {"level":"info","ts":1702406381.9637094,"msg":"shutting down apps, then terminating","signal":"SIGTERM"}
déc. 12 19:39:41 raqo-local caddy[29298]: {"level":"warn","ts":1702406381.9637973,"msg":"exiting; byeee!! 👋","signal":"SIGTERM"}
déc. 12 19:39:41 raqo-local caddy[29298]: {"level":"info","ts":1702406381.9638343,"logger":"http","msg":"servers shutting down with eternal grace period"}
déc. 12 19:39:41 raqo-local caddy[29298]: {"level":"info","ts":1702406381.964169,"logger":"admin","msg":"stopped previous server","address":"localhost:2019"}
déc. 12 19:39:41 raqo-local caddy[29298]: {"level":"info","ts":1702406381.9641893,"msg":"shutdown complete","signal":"SIGTERM","exit_code":0}
déc. 12 19:39:41 raqo-local systemd[1]: caddy.service: Succeeded.


3. Caddy version: --------->v2.7.6

4. How I installed and ran Caddy:

I ran the official script to install it for ubuntu mentioned atthe link above
after that i went to the config file and put in

mansour.taxi {
    reverse_proxy 0.0.0.0:8000
}

raqo.dev {
    reverse_proxy 0.0.0.0:8080
}

Than I was advised that me using 0.0.0.0 may be the issue so I changed it to localhost and a specific ip I set for the sites wich also both did not work

a. System environment:

b. Command:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

5. Links to relevant resources:

From the logs you posted in #1, it kinda seems like you shut Caddy down after getting a certificate for mansour.taxi.

Could you please start by confirming that Caddy is running and then execute:

curl -kIL --resolve mansour.taxi:443:127.0.0.1 https://mansour.taxi/

And post the output.

I can confirm for you here that 0.0.0.0 is not the correct value to place here and you should use either localhost or 127.0.0.1 or even just the port with no hostname (e.g. reverse_proxy :8000), which implies localhost.

While it is often appropriate for a server to listen on 0.0.0.0 (which effectively accepts connections on any interface), it is not appropriate for a server to try to connect to 0.0.0.0.

Are you using Cloudflare tunnels, or just Cloudflare’s “orange cloud” reverse proxy?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.