Thursday, 27 December 2012

Apache Server - new virtual host or site

In order to ease development of many PHP projects simultanious and let the PHP IDE's I am testing update the source automatically I use the following to create new virtual hosts:


sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mynewsite

Edit the new file  to configure the new site, I am using ~/Development/project as the web folder.

sudo a2dissite default
sudo a2ensite mynewsite
sudo service apache2 reload

to activate the new site and reload apache2

4 comments:

  1. Apache was one of the first servers to support IP-based virtual hosts right out of the box. Versions 1.1 and later of Apache support both IP-based and name-based virtual hosts (vhosts). The latter variant of virtual hosts is sometimes also called host-based or non-IP virtual hosts.

    ReplyDelete
  2. Get started today! Buy online the virtual server hosting subscription plan that best fits your business needs. Or, chat online with an Apps4Rent product advisor to help you find the perfect Apps4Rent hosted solution.

    ReplyDelete
  3. There is a lot of information around on how to do this, but the first time I tried it, I found the existing information to be more confusing than helpful. Hopefully, this page will simplify the process a bit. Please note that this information pertains to setting up a virtual host in Apache on a Windows machine for use as a local testing server. Setting up a virtual host for an actual production server is beyond the scope of this article and you should refer to the official Apache documentation for that.

    ReplyDelete
  4. When IP-based virtual hosting is used, each site (either a DNS host name or a group of DNS host names that act the same) points to a unique IP address. The webserver is configured with multiple physical network interfaces, virtual network interfaces on the same physical interface or multiple IP addresses on one interface.

    ReplyDelete