
我有两个网站:
iq-dev.de 和 iq-dev.com
iq-dev.de 运行正常,也可通过 www.iq-dev.de 访问。我有一个安装了 Linux 的云服务器,可通过 ssh 编辑所有内容。
我的主机名是“thor”,我尝试过:
- 将 iq-dev.com 添加到我的主机文件
- 在 apache2 文件中将 iq-dev.com 添加为“sites-enabled”/“sites-available”
我的主机如下所示:
127.0.0.1 localhost localhost
82.223.17.182 iq-dev.com thor
82.223.17.182 iq-dev.de thor
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
在我的可用站点和已启用站点中,我添加了具有以下设置的文件iq-dev.com.conf
:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port t$
# 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 webmaster@localhost
ServerName iq-dev.com
ServerAlias www.iq-dev.com
DocumentRoot /var/www/iq-dev.de/main
# 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
有人能告诉我我哪里出错了吗?我真的不知道现在该怎么办。我搜索了不同的教程来查找 hosts 文件和 sites-available/sites-enabled,但我没有发现任何问题。
我当然想要做的只是让 iq-dev.com 解析为与 iq-dev.de 相同的文件夹。
答案1
您没有设置 DNS A 记录iq-dev.com
联系您的域名提供商,将域名指向您的网络服务器
答案2
如果您希望两个网站上的内容相同,则编辑“iq-dev.de”的配置文件,添加以下内容:
ServerAlias iq-dev.com, www.iq-dev.com