Search code examples
phpapachevirtualhostwampserver

How to add public virtual host in Apache 2.4 with WAMP


I have an Apache server that handles two virtual host on port 8080, one is private (localhost) and a second one is public (internet). The private virtual host works fine but the public keeps redirecting all public requests to the localhost and I'm not sure what I'm doing wrong. Please help! Below is the httpd-vhost.conf file:

# Virtual Hosts

<VirtualHost *:8080>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory  "c:/wamp64/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
</Directory>
</VirtualHost>

<VirtualHost *:8080>
ServerName mydomain.com
DocumentRoot c:/wamp64/www/App
<Directory  "c:/wamp64/www/App/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
#

Also, this is running WAMP / Magento on Windows Server 2012 and hosted in Azure. Thanks a lot!


Solution

  • I found that the virtual host was configured correctly and the re-directing problem was in MySQL Magento Db, which was pointing to the localhost:8080. I changed core_config_data under web/unsecure/base_url and web/secure/base_url to my public domain and it worked fine. I posted this answer in case someone else lands here with a similar problem. Thanks