【问题标题】:How to debug apache virtual hosts and domain conf?如何调试 apache 虚拟主机和域配置?
【发布时间】:2021-03-31 09:11:26
【问题描述】:

我已向运行 apache 的 Amazon linux 服务器添加了一个新域

<VirtualHost *:80>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /var/www/mydomain
    ErrorDocument 404 /index.html
    ErrorLog /var/log/mydomain.com-error_log
    CustomLog /var/log/mydomain.com-access_log common
    <Directory /var/www/mydomain>
       Options FollowSymLinks
       AllowOverride None
       Require all granted
    </Directory>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>

重启服务器 检查状态 sudo systemctl restart httpd 活动(运行)1 分钟 但无论出于何种原因,都会提供默认的 apache index.html 新域的目录存在,index.html 有没有 chmod 644 完成

新域的错误日志为空。 访问日志和错误 lod 为空

-rw-r--r--.  1 root   root           0 Dec 21 15:26 mydomain.com-access_log
-rw-r--r--.  1 root   root           0 Dec 21 09:50 mydomain.com-error_log

主机error_log尾部正常

AH00489: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1c configured -- resuming normal operations
[Mon Dec 21 15:02:24.161922 2020] [core:notice] [pid 73594:tid 140519198484800] 
AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

我觉得有权限/证书问题。或者另一件事 letencrypt crt 可能已成功安装新域

[ec2-user@ip-xx-xx-xx-xx ~]$ wget mywwwdomain.com
--2020-12-21 15:57:26--  http://mywwwdomain.com/
Resolving mywwwdomain.com (mywwwdomain.com)... 55.55.55.55
Connecting to mywwwdomain.com (mywwwdomain.com)|55.55.55.55|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://mywwwdomain.com/ [following]
--2020-12-21 15:57:26--  https://mywwwdomain.com/
Connecting to mywwwdomain.com (mywwwdomain.com)|55.55.55.55|:443... connected.
ERROR: The certificate of ‘mywwwdomain.com’ is not trusted.
ERROR: The certificate of ‘mywwwdomain.com’ hasn't got a known issuer.
The certificate's owner does not match hostname ‘mywwwdomain.com’
[ec2-user@ip-xx-xx-xx-xx ~]$

55.55.55.55 - 我的 IP 地址

如何进一步调试并修复此问题?

【问题讨论】:

  • 附加信息 DNS 记录在 4 小时前已更改,但已传播到我的位置,否则来自 Chrome 的新域名请求不会访问我的单个 IP 服务器
  • 附加信息:```
  • 或者传播还没有到达letsencrypt服务器,我正在尝试为这个新域生成证书?

标签: apache https httpd.conf lets-encrypt


【解决方案1】:

如果您在新文件中添加了新域,请确保新文件正确包含在主 httpd 配置文件中。 您可以通过以下命令获取 apache 正在服务的 VHs 列表: # apache2ctl -S(在 Debian/Ubuntu 上),# apachectl -S(在 CentOS/RHEL 上)或 # httpd -S.

【讨论】:

    猜你喜欢
    • 2011-07-25
    • 2011-05-04
    • 2017-06-14
    • 2012-08-22
    • 2011-10-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多