Apache 和 Ubuntu 上的子域名设置问题

Apache 和 Ubuntu 上的子域名设置问题

我正在努力设置 staging.callkneehill.ca 并使其在 Digital Ocean 的 droplet 服务器上正常运行。

根域 callkneehill.ca 正常运行。

已使用 Digital Ocean 控制面板中的 DNS 管理器将暂存主机名添加为 A 记录。当我运行该dig命令时,终端中返回以下内容。根据此文章,这是正确的答案。

; <<>> DiG 9.16.1-Ubuntu <<>> @ns1.digitalocean.com staging.callkneehill.ca
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61681
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;staging.callkneehill.ca.   IN  A

;; ANSWER SECTION:
staging.callkneehill.ca. 1800   IN  A   178.128.5.204

;; Query time: 92 msec
;; SERVER: 173.245.58.51#53(173.245.58.51)
;; WHEN: Thu May 13 18:51:01 UTC 2021
;; MSG SIZE  rcvd: 68

DNS 记录截图

DNS 记录截图

staging.callkneehill.ca.conf 配置文件已在 /etc/apache2/sites-available 中创建。我已测试了配置,将注释行取消注释,但均不起作用。

每次保存配置时我都会重新启动 Apache。

<VirtualHost *:80>
  ServerName staging.callkneehill.ca
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/staging/
  ErrorLog ${APACHE_LOG_DIR}/staging-error.log
  CustomLog ${APACHE_LOG_DIR}/staging-access.log combined
  # RewriteEngine on
  # RewriteCond %{SERVER_NAME} =staging.callkneehill.ca [OR]
  # RewriteCond %{SERVER_NAME} =staging.callkneehill.ca
  # RewriteRule ^ http://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<Directory /var/www/staging/>
  AllowOverride All
</Directory>
<FilesMatch \.php$>
  # SetHandler "proxy:unix:/run/php/php7.4-callkneehill-fpm.sock|fcgi://localhost"
</FilesMatch>

我也尝试运行sudo certbot run以设置子域的 SSL 证书,但返回了以下响应。

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for staging.callkneehill.ca
Waiting for verification...
Challenge failed for domain staging.callkneehill.ca
http-01 challenge for staging.callkneehill.ca
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:
- The following errors were reported by the server:

Domain: staging.callkneehill.ca
Type:   dns
Detail: DNS problem: NXDOMAIN looking up A for
staging.callkneehill.ca - check that a DNS record exists for this
domain

分期目录在服务器上设置,并且在根目录中有一个空白的index.html文件。

我的浏览器显示我们无法连接到 staging.callkneehill.ca 的服务器当我尝试访问子域时。

非常感谢您的帮助。

干杯,

相关内容