微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法将 Caddy 服务器配置为在我的域名中使用 TLS

如何解决无法将 Caddy 服务器配置为在我的域名中使用 TLS

我已经将域的 A/AAAA 记录指向我的服务器的 IP 地址,当我将服务器的 Caddy 地址放入浏览器时,我确实看到了 IP 主页,但是不带域名。

不确定我的 Caddyfile 更改是否会重新加载。

在浏览器中点击:

http://10.20.30.40 -- I see Caddy home page when I hit my machine's ip address
http://www.mytekworld.com -- The browser just keeps spinning when I hit the domain name
https://www.mytekworld.com -- The browser just keeps spinning when I hit the domain name

sudo nano /etc/caddy/Caddyfile

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block,the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS),first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP,then replace the line below with your
# domain name.
www.mytekworld.com

# Set this path to your site's directory.
root * /usr/share/caddy

# Enable the static file server.
file_server

# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080

# Or serve a PHP site through PHP-fpm:
# PHP_fastcgi localhost:9000

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

--重新加载球童

caddy reload
sudo systemctl reload caddy --caddy.service is not active,cannot reload.

防火墙状态:

Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 22000                      ALLOW IN    Anywhere
[ 2] 80,443/tcp                 ALLOW IN    Anywhere
[ 3] 8080                       ALLOW IN    Anywhere
[ 4] 22786 (v6)                 ALLOW IN    Anywhere (v6)
[ 5] 80,443/tcp (v6)            ALLOW IN    Anywhere (v6)
[ 6] 8080 (v6)                  ALLOW IN    Anywhere (v6)

解决方法

这似乎是 DNS 问题。

确保您的 A 记录看起来像这样

A 10.20.30.40

如果您的 A 记录格式正确,请使用 DNS 记录和您的 DNS 提供商(Cloudflare、Netlify、Godaddy 等)更新您的问题

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。