不确定何时,但 WHM/cPanel 和/或 Apache 已经改变了它们处理不存在的域请求的方式。
以前它会重定向到http://requested-domain.tld/cgi-sys/defaultwebpage.cgi但是现在它只会显示虚拟主机中列出的第一个域的内容,而不会改变域。
我尝试添加以下变体:
/etc/apache2/conf.d/includes/pre_virtualhost_2.conf
/etc/apache2/conf.d/000-default.conf
<VirtualHost *>
ServerName subdomain.server-domain.tld
RedirectPermanent / /cgi-sys/defaultwebpage.cgi
#RewriteEngine on
#RewriteCond %{HTTPS} on
#RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#RewriteCond %{HTTPS} off
#RewriteRule ^/(.*)$ /cgi-sys/defaultwebpage.cgi [L,R=302]
</VirtualHost>
也不将请求重定向到http://requested-domain.tld/cgi-sys/defaultwebpage.cgi
有没有人有什么建议?
答案1
添加以下内容/etc/apache2/conf.d/includes/pre_virtualhost_global.conf
可解决问题:
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName xxx.xxx.xxx.xxx
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost xxx.xxx.xxx.xxx:443>
ServerName xxx.xxx.xxx.xxx
DocumentRoot /var/www/html
<IfModule suphp_module>
suPHP_UserGroup nobody nobody
</IfModule>
<Directory "/var/www/html">
AllowOverride All
</Directory>
<IfModule ssl_module>
SSLEngine on
SSLCertificateFile /var/cpanel/ssl/cpanel/cpanel.pem
SSLCertificateKeyFile /var/cpanel/ssl/cpanel/cpanel.pem
SSLCertificateChainFile /var/cpanel/ssl/cpanel/cpanel.pem
SSLUseStapling Off
</IfModule>
<IfModule security2_module>
SecRuleEngine On
</IfModule>
</VirtualHost>
对于具有多个 IP 地址的服务器,您需要为每个 IP 进行复制。
https://support.cpanel.net/hc/en-us/articles/360061002473-如何为每个 IP 地址设置默认虚拟主机-