Apache Multiple Site Configuration

Someone in the group said they didn’t know how to configure multiple sites with phpstudy. Actually this isn’t hard — the setup I did back then wasn’t an integrated environment, and the configuration is the same for integrated and non-integrated environments alike. First we need to find the Apache configuration file E:\phpStudy\Apache\conf\httpd.conf, then open the file and search for httpd-vhosts.conf. So we find

apache

Remove the leading #, then follow that path to find the httpd-vhosts.conf file and open it. Find this section: # # 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. # Check whether NameVirtualHost :80 appears before it; if not, add it. Then find #<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 # After removing the leading #, change the paths and the domain names.

virtual site configuration

That’s all. I’d suggest using a standalone configuration rather than an integrated environment — an integrated environment configures too many things, which easily causes conflicts and errors. This method is only for running on a server; I haven’t tested running it locally and I’m not sure about it at the moment.