문제

I try to set up virtual hosts on my server. I already add virtual host for my default domain:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /srv/www/domain.com
</VirtualHost>

<Directory /srv/www/domain.com>
    Options +FollowSymLinks -Indexes
    AllowOverride All
    order allow,deny
    allow from all
</Directory>

Now domain.com and www.domain.com has document root /srv/www/domain.com

But www1.domain.com, www2.domain.com, ..., *.domain.com domains also have document root /srv/www/domain.com. How to deny access to server from all domains beside domain.com and www.domain.com?

도움이 되었습니까?

해결책

I just need to add before virtual hosts:

ServerName localhost

<VirtualHost _default_:80>
    <Directory />
        deny from all
    </Directory>
</VirtualHost>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top