How to add multiple port numbers and multiple web roots in Apache in localhost

Add the following at the end of Apache’s httpd.conf file, which is located in ApacheHomeDirectory/conf/

Listen 88

<VirtualHost *:88>
    DocumentRoot "C:\Users/anna/Documents/Sites/test"
</VirtualHost>

<Directory "C:\Users/anna/Documents/Sites/test">
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
</Directory>

Then restart Apache server, if you have an index page in C:\Users/anna/Documents/Sites/test/, type the following in your favorite browser, it should show the index page.

http://localhost:88

If you want to change the localhost:88 to another domain name such as myWeBlog.com, add this line to the hosts file
127.0.0.1 myWeBlog.com
Then, you can access the site from myWeBlog.com:88

The hosts file in Windows:
C:\Windows\System32\drivers\etc\hosts

The hosts file in Mac OS or Linux:
/etc/hosts

Search within Codexpedia

Custom Search

Search the entire web

Custom Search