开发者社区 > 域名解析DNS > DNS最佳实践 > 正文

PHP下使用Apache如何在本地搭建泛解析呢?

目前我通过修改httpd-vhosts.conf和hosts文件,想要达到泛解析的目的。
但是在hosts文件中需要将要解析的域名事先写好。感觉这样子很麻烦,不知道有没有更好的实现方法呢?
httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot "d:/www/"
    ServerName test.com
    ServerAlias *.test.com
</VirtualHost>

hosts文件

127.0.0.1       1.test.com
127.0.0.1       2.test.com
127.0.0.1       3.test.com
127.0.0.1       4.test.com
127.0.0.1       5.test.com
127.0.0.1       6.test.com
127.0.0.1       7.test.com
127.0.0.1       8.test.com
127.0.0.1       9.test.com
127.0.0.1       10.test.com
127.0.0.1       11.test.com
127.0.0.1       12.test.com
127.0.0.1       13.test.com
127.0.0.1       14.test.com
127.0.0.1       15.test.com
127.0.0.1       16.test.com
127.0.0.1       17.test.com
127.0.0.1       18.test.com
127.0.0.1       19.test.com
127.0.0.1       20.test.com
127.0.0.1       21.test.com
127.0.0.1       22.test.com
127.0.0.1       23.test.com
127.0.0.1       24.test.com
127.0.0.1       25.test.com
127.0.0.1       26.test.com
127.0.0.1       27.test.com
127.0.0.1       28.test.com
127.0.0.1       29.test.com
127.0.0.1       30.test.com

展开
收起
落地花开啦 2016-06-17 17:54:46 3445 0
2 条回答
写回答
取消 提交回答

使用DNS和运维DNS相关的最佳实践

相关产品

  • 云解析DNS
  • 相关电子书

    更多
    Apache Flink技术进阶 立即下载
    Apache Spark: Cloud and On-Prem 立即下载
    Hybrid Cloud and Apache Spark 立即下载

    相关镜像