Access virtual host from another machine over LAN

In addition to danp’s answer, you can access the virtual host without having to change the client machine’s etc/hosts file by assigning a port to the virtual host. This is ideal if you want to access the server with a mobile or tablet device:

  1. Edit server’s httpd.conf file at:

    \wamp\bin\apache\apache2.2.x\conf\httpd.conf
    

    Search for “Listen” (around line 61). You should see the following that allows for Apache to listen for port 80:

    Listen 0.0.0.0:80
    Listen [::0]:80
    

    Add the following lines to add listening for port 81 (or any port):

    Listen 0.0.0.0:81
    Listen [::0]:81
    
  2. Edit the httpd-vhosts.conf file at:

    \wamp\bin\apache\apache2.2.x\conf\extra\httpd-vhosts.conf
    

    Change your “Virtual Host” tag to port 81:

    <VirtualHost *:81>
        DocumentRoot "D:/websites/project1/"
        ServerName www.project1.com
    </VirtualHost>
    
  3. Restart Apache server.

  4. On the client machine/tablet/mobile, on the web browser, enter the server’s IP address (192.168.0.10, or whatever IP) followed by the port number in the following format:

    http://192.168.0.10:81
    

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)