Search code examples
apachewampserver

WAMP 2.5 (Apache 2.4.9) enable access from all computer on LAN


I built 2 websites locally using WAMP and I would like to make it accessible to anyone in or local network.

I set up 2 virtual hosts with the following configuration in my httpd-vhosts.conf:

#Vistage
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/wamp/www/vistagebusinessexpo.com"
    ServerName vistagebusinessexpo.local
    ServerAlias www.vistagebusinessexpo.local
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
    <Directory  "C:/wamp/www/vistagebusinessexpo.com">
        AllowOverride All
        Options Indexes FollowSymLinks
        Require local
    </Directory>
</VirtualHost>

#CaterCon
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/wamp/www/catercon.com"
    ServerName catercon.local
    ServerAlias www.catercon.local
    ErrorLog "logs/dummy-host2.example.com-error.log
    CustomLog "logs/dummy-host2.example.com-access.log" common
    <Directory  "C:/wamp/www/catercon.com">
        AllowOverride All
        Options Indexes FollowSymLinks
        Allow from 127.0.0.0/8 localhost ::1 10.1.1
    </Directory>
</VirtualHost>

My Windows/System32/drivers/etc/hosts file is configured as follow:

127.0.0.1       localhost
127.0.0.1       vistagebusinessexpo.local
::1             vistagebusinessexpo.local
127.0.0.1       catercon.local
::1             catercon.local

The problem is that each time I am try to connect from any other computer in our network I get "Error 403 Access Denied/Forbidden"

So far I tried multiple suggestions:

  • Click the "Put Online" button and try Accessing the website with IPAdress/website.local
  • Modifying the httpd.conf file to allow access to all the IP on our local network
  • Modifying the httpd.conf file to "allow from allow"

Right now I am running out of solutions


Solution

  • Ok,

    Point 1: As soon as you configure your own Virtual Hosts the use of the Put Online and Put Offline menus becomes irrelevant, as Apache will ignore the localhost configured in the httpd.conf file, which is the only thing amended by using those menus.

    Point 2: You should really configure localhost as a Virtual Host as well as your other sites. It should be the first VH in the definition file so making it the default site, if someone uses the ip address of your server they will then get a Access Not Allowed as long as you leave it configured as Require local only.

    Point 3: For some reason you are using Apache 2.2 access syntax in one VH and 2.4 in the other. As you are using Apache 2.4, stick with the 2.4 syntax. The 2.2 syntax does work if you have mod_access_compat.so activated in Apache, but why bother!

    Point5: Each of your VHOST's is now configurable seperately, but must be done manually ( edit and restart Apache )

    So can I suggest you try this as your httpd-vhosts.conf file

    #localhost
    # Always have this as the first VHOST
    # Never have access set to anything other than 'require local'
    # The any access using ip address of your server will get sent here
    ## and get a Not Allowed Error
    <VirtualHost *:80>
        ServerName localhost
        DocumentRoot c:/wamp/www
        <Directory  "c:/wamp/www/">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require local
        </Directory>
    </VirtualHost>
    
    #Vistage
    <VirtualHost *:80>
        DocumentRoot "c:/wamp/www/vistagebusinessexpo.com"
        ServerName vistagebusinessexpo.local
        ServerAlias www.vistagebusinessexpo.local
        ErrorLog "logs/vistagebusinessexpo-error.log"
        CustomLog "logs/vistagebusinessexpo-access.log" common
        <Directory  "C:/wamp/www/vistagebusinessexpo.com">
            AllowOverride All
            Options Indexes FollowSymLinks
            Require local
            Require ip 10.1.1
        </Directory>
    </VirtualHost>
    
    #CaterCon
    <VirtualHost *:80>
        DocumentRoot "c:/wamp/www/catercon.com"
        ServerName catercon.local
        ServerAlias www.catercon.local
        ErrorLog "logs/catercon-error.log
        CustomLog "logs/catercon-access.log" common
        <Directory  "C:/wamp/www/catercon.com">
            AllowOverride All
            Options Indexes FollowSymLinks
            Require local
            Require ip 10.1.1
        </Directory>
    </VirtualHost>