Bad gateway Error code 502 for own website

I know there are a lot of other responses for this but I could not find any solutions. (also because there is a lot too look through)
Im running the newest Ubuntu server on a laptop. I can access the server with the ip address on the same network but the domain name gives me this error. I have tried to reinstall everything and made sure dns records are working and the tunnel does say “healthy”.
Do I have to do anything with port forwarding or something like that?

Im new to this so any explanation or links to anything would help.
I’m trying to make my own website with Wordpress and I’m using apache2

What do the logs from Cloudflared say? You can view them following either method listed here: Tunnel logs · Cloudflare Zero Trust docs

hopefully this is the right stuff

That’s the incoming request. There should be an error message in the logs which will help.

is this what you are looking for?

2024-01-02T23:56:20Z error http {“cfRay”:“83f6f0232ec677c9-GRU”,“error”:“Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp 192.168.1.161:443: connect: connection refused”,“ingressRule”:“0”,“originService”:“https://192.168.1.161”}

Yes!
That error message means that the connection to the origin service was refused by the origin service. From the machine running cloudflared are you able to reach the host?

What do yo mean exactly?
It’s my own computer in my network. I can ssh and use the ip in my browser to connect to it when I’m on the same network

You need to access the device running the cloudflared and see if that device is able to reach the IP.

im on the computer that is running cloudflare and I can put in my websites ip and it successfully connects.

When you connect locally, are you using http/port 80 or https/port 443 as cloudflared is trying to use https to port 443.

I just connect with just the ip.

Try changing your tunnel config to use http and port 80 to connect to the origin service instead of https.

tunnel: tunnel id numbers
credentials-file: /home/peyton/.cloudflared/cert.pem
ingress:
   - hostname: domain.com
     service: http://localhost:80
   - hostname: domain.com
     service: https://localhost:443
     originRequest:
        noTLSVerify: true
   - service: http_status:404