我正在尝试托管2个网站,使用2个合法的域名,这些域名已经注册并且确实有效,我的问题是,当我试图加载第二个域名时,它会重定向到第一个域名,而不是加载第二个域名。(例如,我有google1.com和google2.com,当我访问google2.com时,它会重定向到google2.com)
这是第二个网站的配置(这里不使用真实域名)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName domain.xyz
ServerAlias www.domain.xyz
DocumentRoot /var/www/thewest
</VirtualHost>启用站点是正确的(使用a2ensite)
lrwxrwxrwx 1 root root 31 May 12 11:10 default.conf -> ../sites-available/default.conf
lrwxrwxrwx 1 root root 31 May 12 12:01 thewest.conf -> ../sites-available/thewest.conf我已经在apache2.conf上配置了目录
<Directory /var/www/thewest>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>但这种情况仍然会发生。但是为什么呢?编辑:这是在使用Raspbian的Raspberry Pi上运行的,我还应该指出我使用的是DDNS服务。
发布于 2018-05-13 14:58:58
打开Apache配置文件,并确保在虚拟主机部分之前添加了以下行:
NameVirtualHost *80不要忘记重新启动Apache以使更改生效。
https://stackoverflow.com/questions/50306117
复制相似问题