How do I point Cloudflare Tunnel to my NGINX proxy manager? reddit / selfhosted ---------------------------------------------------------------------- iizakill · 2023-12-23 22:50 I am spiraling down the rabbit hole of self-host. I and only a few family members might use my self-hosted URLs. I decided to use Cloudflare Tunnel instead of a Wireguard VPN. I want to point my Cloudflare tunnel to my NGINX proxy manager, and then the proxy manager should resolve the request locally. Could anyone tell me how to achieve this? I am new to this, so would greatly appreciate it if it could be explained as if I am 5. Thank you :) ---------------------------------------------------------------------- shoesli_ · 2023-12-23 23:35 Welcome, I am a long time homelab addict (not recovering) so I have done this, but I did it with traefik unfortunately so it’s probably very different. I was mostly testing cloudflares tunnel then, now I only have their proxy and my traefik proxy. Do you really need CF tunnel and a reverse proxy? If it’s mainly web traffic you really don’t need CF tunnel imo ---------------------------------------------------------------------- iizakill · 2023-12-24 01:33 I don't like to keep my ports open, so want to try to go the CF tunnel way but also want to only expose one endpoint to CF and want my NGINX proxy to do the rest.....I am being picky haha ---------------------------------------------------------------------- AnApexBread · 2023-12-24 02:35 What issues are you running into ---------------------------------------------------------------------- RedditSlayer2020 · 2023-12-24 04:02 Read clownflare docs or ask r/cloudflare ---------------------------------------------------------------------- iizakill · 2023-12-24 05:17 I am not sure where/how to point the tunnel to nginx. So as of now, I provide a subdomain name and give my local IP & port where the service is running. Instead I want a way to provide NGINX, and it should resolve my request. ---------------------------------------------------------------------- thomasdarko · 2023-12-24 09:31 It’s really not that complicated, take a look [here](https://youtu.be/ZvIdFs3M5ic?si=ZLsODBfRRxIyelT9) and [here](https://youtu.be/yMmxw-DZ5Ec?si=Gmhxo93KNWc0KVbx). ---------------------------------------------------------------------- Rorixrebel · 2023-12-24 17:02 You have to run the tunnel in the same node where the proxy runs or have it be reachable from that machine. Then point your tunnel to your proxy. Shameless plug but i wrote bout it https://mvaldes.dev/blog/cloudflare-tunnels/ ---------------------------------------------------------------------- iizakill · 2023-12-24 17:19 I am using the Cloudflare website GUI to implement the tunnel. Do you know what settings to change there? ---------------------------------------------------------------------- hazm4tt · 2023-12-24 21:27 I have done this, its pretty straight forward, i'll use generic examples On the CF tunnel Public hostname: subdomain: www domain: domain.com Service: Type: HTTP(s) or depending on what you have NGINX set to. URL: IP address of the NGINX server Additional App Options: HTTP Host Header: set to what NGINX expects to see "www.domain.com" If you're using HTTPS: TLS: Enable "No TLS Verify" ---------------------------------------------------------------------- Macley6969 · 2023-12-25 17:47 Is there a reason why you still want to use nginx? You can use cloudflared to resolve internal addresses that nginx does now. Makes it less complex ---------------------------------------------------------------------- iizakill · 2023-12-25 19:17 It still gives a host error. For your URL, which port did you use? 443, 80 or 81? ---------------------------------------------------------------------- hazm4tt · 2023-12-25 19:26 If you're using HTTPS port 443, HTTP port 80. Can you share a screenshot of the "host error"? ---------------------------------------------------------------------- iizakill · 2023-12-25 19:37 I configured it just like that for my HTTPS. Error similar to this: ht tps://images.ctfassets.net/slt3lc6tev37/CTIa7Nqay9uZoBZnh7ao7/e61d8968 ea919d75b26e0098437f7174/image1.png ---------------------------------------------------------------------- hazm4tt · 2023-12-25 20:21 Internally, if you go to www.example.com (directly to the NGINX Proxy Manager) does it work without issue? If you have the host header being sent, and ignoring TLS through the tunnel, NGINX should process it. The message you see is a good sign, CF tunnels is talking to NGINX, but NGINX is sending the error. Make sure nginx is handling the domain as you anticipate it is. ---------------------------------------------------------------------- hazm4tt · 2023-12-26 16:54 Any update? ---------------------------------------------------------------------- iizakill · 2023-12-26 17:20 My bad, I missed your comment notification. Internally it does not resolve if I directly type in the URL, do I need to set up a DNS resolver such as PiHole? ---------------------------------------------------------------------- hazm4tt · 2023-12-26 17:49 on whatever machine you're testing with, edit your hosts file to point www.example.com to the servers private IP address. [How-to](https://www.siteground.com/kb/hosts-file/) ---------------------------------------------------------------------- iizakill · 2023-12-26 20:28 Thank you SO much, I am away from my setup, but I'll try this and get back to you :)