Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to use <VirtualHost> directive to easily create multiple local hosts in Apache2 server?

user-image
Question added by Ahmed Sabra , Integration Support Engineer- Fintech , Saudi Financial Technology Company
Date Posted: 2015/08/27
Ahmed Sabra
by Ahmed Sabra , Integration Support Engineer- Fintech , Saudi Financial Technology Company

I solved it, but i will put it here maybe it helps someone:

Add the following to your Apache config file, typically its name is: httpd.conf

<VirtualHost *:80>

ServerAdmin webmaster@localhost

DocumentRoot "D:/MAMP/htdocs"

ServerName localhost

ServerAlias localhost

ErrorLog "logs/localhost-error.log"

CustomLog "logs/localhost-access.log" common

</VirtualHost>

 

<VirtualHost *:80>

ServerAdmin webmaster@newlocal

DocumentRoot "D:/MAMP/htdocs/new"

ServerName newlocal

ServerAlias newlocal

ErrorLog "logs/newlocal-error.log"

CustomLog "logs/newlocal-access.log" common

</VirtualHost>

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.