[英]Apache virtual host subdomains not working
I am using httpd-vhosts.conf,apache version 2.4.51 and Windows Server.我正在使用 httpd-vhosts.conf、apache 版本 2.4.51 和 Windows 服务器。 The subdomain is not working.
子域不工作。
httpd-vhosts.conf: httpd-vhosts.conf:
NameVirtualHost *:80
#
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "e:/wamp64/www/mydomain.com"
<Directory "e:/wamp64/www/mydomain.com/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName subdomain.mydomain.com
ServerAlias subdomain.mydomain.com
DocumentRoot "e:/wamp64/www/mydomain.com/subdomain"
<Directory "e:/wamp64/www/mydomain.com/subdomain/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Both mydomain.com and www.mydomain.com works great! mydomain.com 和www.mydomain.com都很好用!
But if i try using: http://subdomain.mydomain.com i always got the error:但如果我尝试使用: http://subdomain.mydomain.com我总是得到错误:
Hmm. We’re having trouble finding that site.
We can’t connect to the server at subdomain.mydomain.com
If that address is correct, here are three other things you can try:
Try again later.
Check your network connection.
If you are connected but behind a firewall, check that Firefox has permission to access the Web.
hosts file is correct too:主机文件也是正确的:
127.0.0.1 mydomain.com
::1 mydomain.com
127.0.0.1 subdomain.mydomain.com
::1 subdomain.mydomain.com
PS I can access it directly from the host machine, but i can't on another device. PS我可以直接从主机访问它,但我不能在另一台设备上。
Why only the subdomain is not working, please?请问为什么只有子域不起作用? What am i missing?
我错过了什么?
Thank you!!!谢谢!!!
It seems to be more a DNS problem than a config problem on your serveur.它似乎更像是 DNS 问题,而不是服务器上的配置问题。 Did you set any DNS for your subdomain?
您是否为您的子域设置了任何 DNS? Maybe you could find some help here:
也许你可以在这里找到一些帮助:
https://www.godaddy.com/help/create-a-subdomain-4080 https://www.godaddy.com/help/create-a-subdomain-4080
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.