我不确定发生了什么,但是当我从一个 VPS 提供商更换到另一个 VPS 提供商时,这一切都发生了。
我有多个网站,全部通过 Cloudflare 连接,全部指向同一个 VPS 和 Apache2 设置。
我有https://level42.ca, 和https://lumpysoft.com
level42.ca 运行良好,无论是在 http 还是 https 上,而 lumpysoft.com 在我尝试连接时却出现 522 错误。我比较了这两个网站的 sites-enabled.conf 文件,从配置上看,它们几乎完全相同。
不过奇怪的是,如果我通过子域名(也指向同一个 IP)访问 lumpysoft.com,那么它就能正常工作并让我通过。
我读过的大量资料表明,要么是防火墙问题(我对此表示怀疑,因为 level42.ca 无法正常运行),要么是服务器配置错误,如果是的话,我无法找到。
下面是我的两个 .conf 文件,也许有人能看到我没看到的东西......
level42.ca
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin [email protected]
ServerName level42.ca
ServerAlias www.level42.ca
DocumentRoot /var/www/html/level42.ca/public_html
<Directory /var/www/html/level42.ca/public_html>
# Options Indexes FollowSymLinks
AllowOverride All
# Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
# LogLevel alert rewrite:trace3
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
lumpysoft.com
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin [email protected]
ServerName lumpysoft.com
# ServerAlias cannot be the same as ServerName
ServerAlias www.lumpysoft.com
DocumentRoot /var/www/html/lumpysoft.com/public_html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
编辑,这是我的 Ubuntu 服务器上的防火墙配置:
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22/tcp ALLOW IN Anywhere
80/tcp ALLOW IN Anywhere
25/tcp (Postfix) ALLOW IN Anywhere
Anywhere DENY IN 115.249.75.237
22/tcp (v6) ALLOW IN Anywhere (v6)
80/tcp (v6) ALLOW IN Anywhere (v6)
25/tcp (Postfix (v6)) ALLOW IN Anywhere (v6)
DNS:
lumpysoft.com:https://i.stack.imgur.com/dQb3m.jpg
level42.ca:https://i.stack.imgur.com/TMYab.jpg