dns - apache中具有相同ip和端口的多个域

标签 dns virtualhost apache domain-name

我想在我的 VPS 中使用相同的 ip 和端口绑定(bind)两个不同的域,这是我的 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>

我可以使用类似 *.bbb.com 的语法来配置 ServerName 吗? 所以我可以使用 DocumentRoot/disk1/allen/www 访问 www.bbb.com、bbs.bbb.com。

现在我访问bbs.bbb.com,它会转到/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>

关于dns - apache中具有相同ip和端口的多个域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10763234/

相关文章:

dns - 如何在 Go 中查找 NAPTR 记录?

powershell - 当 TLD 托管在 O365 上时,如何使用 POWERSHELL 创建 CNAME 记录?

mysql - XAMPP + OSX + Virtualhosts + 在 httpd.conf 中更改用户 = phpmyadmin 创建数据库不工作

php - .htaccess 导致下载所有页面

python - 配置 htaccess 以提供静态 django 文件

java - 获取客户订单 : Set<Order> getAllOrders() vs. Set<Integer> getAllOrders()

dns - 如何使用具有不可替代 token 标准的 RNS 域? (比如 ERC721)

apache - 在 Ubuntu 12.04 上的 Apache2 中配置 VirtualHost 的问题

apache - 具有相同端口的不同虚拟主机

PHP fatal error : Maximum execution time of -1 seconds exceeded in