简体   繁体   English

Apache vhost通配符不起作用

[英]Apache vhost wildcard not working

This was working before but mysteriously doesn't work anymore. 这以前曾起作用,但神秘地不再起作用。 I'm trying to add a wildcard subdomain which points to the exact same folder as the main domain. 我正在尝试添加一个通配符子域,该子域指向与主域完全相同的文件夹。

Here is my vhost: 这是我的虚拟主机:

<VirtualHost *:80>
    ServerName leadbind.dev
    ServerAlias *.leadbind.dev
    DocumentRoot "c:/wamp64/www/leadbind/public"
    <Directory  "c:/wamp64/www/leadbind/public/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

I saved and restarted DNS. 我保存并重新启动了DNS。

When I visit leadbind.dev it works, but when I visit test.leadbind.dev it does not and Chrome says This site can't be reached . 当我访问leadbind.dev它可以工作,但是当我访问test.leadbind.dev它不能工作,并且Chrome表示无法访问This site can't be reached This used to work with a different domain/subdomain wildcard I had set up as a vhost, but not this one. 这曾经与我设置为虚拟主机的另一个域/子域通配符一起使用,但不是这个。

Why is this not working? 为什么这不起作用?

I figured it out. 我想到了。 Apparently I needed to add the actual subdomain to the windows hosts file because Windows does not like wildcard subdomains. 显然,我需要将实际的子域添加到Windows主机文件中,因为Windows不喜欢通配符子域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM