简体   繁体   中英

Multiple domain with the same ip and port in apache

I want to bind two different domain in my VPS with the same ip and port, here is my httpd.conf :

<VirtualHost 106.187.96.123:80>
    DocumentRoot /home/roy/sobuhu
    ServerName aaa.com
</VirtualHost>

<VirtualHost 106.187.96.123:80>
    DocumentRoot /disk1/allen/www
    ServerName bbb.com
</VirtualHost>

<VirtualHost 106.187.96.123:80>
    DocumentRoot /disk1/allen/www
    ServerName www.bbb.com
</VirtualHost>

Can I config the ServerName use syntax like *.bbb.com ? so I can access www.bbb.com、bbs.bbb.com with the DocumentRoot /disk1/allen/www .

Now I visit bbs.bbb.com, it will turn to /home/roy/sobuhu .

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /home/roy/sobuhu
    ServerName aaa.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /disk1/allen/www
    ServerName bbb.com
    ServerAlias *.bbb.com
</VirtualHost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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