我试图添加子域到我的域名。 我刚刚在我干净的centos 7上安装了httpd。起初,我使用以下内容创build了文件/etc/httpd/conf.d/htmltest.mydomain.com.conf:
<VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin [email protected] ServerName htmltest.mydomain.com DirectoryIndex index.html index.php DocumentRoot /www/sites/htmltest.mydomain.com/htdocs # Log file locations LogLevel warn ErrorLog /www/sites/htmltest.mydomain.com/log/error.log CustomLog /www/sites/htmltest.mydomain.com/log/access.log combined </VirtualHost> <Directory "/www/sites/htmltest.mydomain.com/htdocs"> Options Indexes FollowSymlinks AllowOverride None Require all granted </Directory>
另外/www/sites/htmltest.mydomain.com/htdocs文件夹是用index.html文件创build的。 有了这个configuration,我尝试访问htmltest.mydomain.com在浏览器中给出'服务器DNS地址无法find'的错误。 但是,mydomain.com会打开htmltest子域index.html。 在我的托pipeCP DNS设置有mydomain.com与htmltest'A'logging指向服务器IP,以及WWWlogging。 我怎样才能解决这个问题?
UPD:我已经改变域使用vultr nameservers,它现在正常工作。
好吧,根据你的截图,你有2个不同的url,你可以使用的主机头可能是:
htmltest.mydomain.com
这不是你想要的,但你想:
所以你应该删除前两个(除非你想保留它们,这是完全有效的),并添加www.htmltest.mydomain.com作为Alogging与适当的IP地址。
只是谨慎的一句话,你可能需要检查你的托pipe服务提供商; 有时简单地添加上面的主机logging(与子域)可能不是完成这项工作所需的全部。 由于我不知道您的托pipe服务提供商,我不能肯定地说,但通常这种方法将起作用。