我正在使用 httpd-vhosts.conf、apache 版本 2.4.51 和 Windows Server。子域不起作用。
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>
mydomain.com 和www.mydomain.com都很好用!
但是,如果我嘗試使用: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 檔案也是正確的:
127.0.0.1 mydomain.com
::1 mydomain.com
127.0.0.1 subdomain.mydomain.com
::1 subdomain.mydomain.com
PS我可以直接從主機訪問它,但我不能在其他設備上。
為什么只有子域不起作用?我錯過了什么?
謝謝!!!
uj5u.com熱心網友回復:
這似乎更像是 DNS 問題,而不是您的服務器上的配置問題。您是否為您的子域設定了任何 DNS?也許你可以在這里找到一些幫助:
https://www.godaddy.com/help/create-a-subdomain-4080
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/376345.html
