apache服务器多站点配置

群里有网友说不知道phpstudy怎配置多站点,其实这个不难,我当初配置的不是集成环境,集成环境和不是集成环境都一样的配置 首先我们要找到apache配置文件 E:\phpStudy\Apache\conf\httpd.conf 然后打开文件查找httpd-vhosts.conf 于是我们查找到 apache 去掉前面的# 然后按这个路径找到httpd-vhosts.conf文件并打开 找到这段 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any block. # 看看前面有 NameVirtualHost :80 如果没有就加上 然后找到 #<VirtualHost :80> # ServerAdmin webmaster@dummy-host.example.com # DocumentRoot “/Apache24/docs/dummy-host.example.com” # ServerName dummy-host.example.com # ServerAlias www.dummy-host.example.com # ErrorLog “logs/dummy-host.example.com-error.log” # CustomLog “logs/dummy-host.example.com-access.log” common # # # ServerAdmin webmaster@dummy-host2.example.com # DocumentRoot “/Apache24/docs/dummy-host2.example.com” # ServerName dummy-host2.example.com # ErrorLog “logs/dummy-host2.example.com-error.log” # CustomLog “logs/dummy-host2.example.com-access.log” common # 去掉前面的#后,修改路径和域名 虚拟站点配置 到此结束,建议最好用独立配置,别用集成环境,集成环境配置的东西太多容易冲突出错,此方法仅限在服务器上运行,本地运行没测试过,目前不清楚。