[V2] Caddy only connects to ipv6

1. Caddy version (caddy version):

v2.0.0 - Binaries for Linux amd64 manually downloaded or via apt-get

2. How I run Caddy:

a. System environment:

Ubuntu 16.04.06, systemd 229

b. Command:

caddy start

and

sudo caddy start

from user caddy and root (for testpurposes)

c. Service/unit/compose file:

Not ported to systemd229 yet. So none used.

d. My complete Caddyfile or JSON config:

80

bind 0.0.0.0

root * /usr/share/nginx/html

but also all other tries without using bind or using the tutorial files etc. are not working to connect with ipv4.

3. The problem I’m having:

I´m running a small vServer, for which I have a limited choice of OS due to my provider. This means an OS upgrade to a newer version is currently not possible. Because it’s the first full configuration of the server, I want to configure it directly to serve TLS v1.3, so I don’t have the problem to reconfigure / upgrade TLS v1.2 → TLS v1.3 in productive use later on. Therefore I found Caddy v2 as the solution. Now every configuration I tried to start Caddy with leads to the Problem that Caddy only connects to IPv6-Ports, except the Admin-Port 2019.

Currently no other tool is listening to Port 80 and 443, neither on IPv4 nor on IPv6.

Using nginx instead of caddy, will work correctly. But that is no option, cause of the TLS-“Problem”.

4. Error messages and/or full log output:

netstat -tulpn:

tcp        0      0 127.0.0.1:2019          0.0.0.0:*               LISTEN      3963/caddy
tcp6       0      0 :::443                  :::*                    LISTEN      3963/caddy
tcp6       0      0 :::80                   :::*                    LISTEN      3963/caddy

5. What I already tried:

I´ve tried several sources to install Caddy, including the Ubuntu-Repository and directly downloading the binaries from github. Also different configurations (as reverse_prox, file_server, tutorial-scripts) will not work correctly. Interesting is, that port 2019 will be bind to an ipv4 address only as it can be seen above.

6. Links to relevant resources:

Only relevant post, i`ve found so far: Caddy only serving on ipv6 - #2 by matt

Thanks in advance for your help!



EDIT: May 19th, 2020 - 22:44:
The solution was to bind the server to the specific IP of my webserver. Not just to the generic one 0.0.0.0.
Now the server serves the content as expected on IPv4 Port 80. :slight_smile: Thanks for the suggestions and help!

I think you missed a colon in front of the port number for your site label.

Also root on its own won’t do anything, you’ll need to enable a file_server if that’s what you’re looking to serve.

Thanks for your fast reply!

Actually the given Caddyfile was something odd, sorry. Using :80 during my other tries, does not work either.

The point with file_server is correct. I missed it at mistake, during my last rewrites of the Caddyfile to start some basic config connecting to ipv4:80. Thanks!

Now the Caddyfile looks like:

:80

bind 0.0.0.0

file_server
root * /usr/share/nginx/html

But even with your approches the server only connects to ipv6.

tcp        0      0 127.0.0.1:2019          0.0.0.0:*               LISTEN      4293/caddy
tcp6       0      0 :::80                   :::*                    LISTEN      4293/caddy

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