TECHIES WORLD

For Techs.... Techniques.... Technologies....

ApacheLinuxMysqlPHPWindows

How to enable apache to accept connections from outside in WAMP

WampServer refers to a software stack for the Microsoft Windows operating system, created by Romain Bourdon and consisting of the Apache web server, OpenSSL for SSL support, MySQL database and PHP programming language.

This article explains the steps to enable apache to accept outside connection in WAMP server.

Step1: Open the virtualhost config file.

C:\wamp\bin\Apache2.4\conf\extra\httpd-vhosts.conf

Step2: Edit the Directory configuration of the vhost to allow access from the desired IP address(es).

<VirtualHost *:80>
  ServerAdmin admin@example.com
  DocumentRoot "c:/wamp/www/example"
  ServerName example.com
  ServerAlias www.example.com
  ErrorLog "logs/example.com-error.log"
  CustomLog "logs/example.com-access.log" common
  <Directory "/">
    Deny from all
    Allow from 127.0.0.1
    Allow from ipaddress1
    Allow from ipaddress2
    <IfModule mod_headers.c>
      SetEnvIfNoCase Origin "https?://(www\.)?(example\.com)(:\d+)?$" AccessControlAllowOrigin=$0
      Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
    </IfModule>
  </Directory>
</VirtualHost>

Step3: Save the updated vhost configuration and restart Apache.

Leave a Reply