Configuration
I am running Windows Server 2012 with XAMPP installed in C:\xampp Apache running as a Service
I have edited host file in C:\Windows\System32\Drivers\etc, added following
127.0.0.1 landing.local
I added vhost in C:\xampp\apache\conf\extra\httpd-vhosts.conf
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot C:/xampp/htdocs/
ServerName localhost
ServerAlias localhost
</VirtualHost>
<VirtualHost landing.local:80>
DocumentRoot "C:/xampp/htdocs/landing"
ServerName landing.mydomain.com
ServerAlias landing.mydomain.com
</VirtualHost>
I also uncommented following line in httpd-vhosts.conf
NameVirtualHost *:80
and in httpd.conf
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include "conf/extra/httpd-vhosts.conf"
and Apache is configured to Listen on port 80.
Listen 80
Where landing.mydomain.com is redirected to Public Virtual IP from Windows Azure.
Problem
When I access locally http://landing.local/ site works But when I try to access landing.mydomain.com from inside network it doesn't work, instead it redirects to main localhost site.
So I tried using landing.mydomain.com in hosts and landing.mydomain.com in vHost.
<VirtualHost landing.mydomain.com:80>
DocumentRoot "C:/xampp/htdocs/landing"
ServerName landing.mydomain.com
ServerAlias landing.mydomain.com
</VirtualHost>
This time I am able to access landing.mydomain.com from inside network, on server but when I try to access it from outside local network it doesn't work.
I also tried editing host file and pointing landing.mydomain.com to my Public Virtual IP or Internal IP address. Didn't help...
<VirtualHost landing.mydomain.com:80>
DocumentRoot "C:/xampp/htdocs/landing"
ServerName landing.mydomain.com
ServerAlias landing.mydomain.com
</VirtualHost>
Host file
255.255.255.255 landing.mydomain.com
Where 255.255.255.255 is my Public Virtual IP and 255.255.255.254 Internal IP but it didn't work. It would just open my localhost (homepage of mydomain.com)
255.255.255.254 landing.mydomain.com
Also I tried to
Bind Apache to Public Virtual IP 255.255.255.255 by editing httpd.conf
Listen 255.255.255.255:80
(OS 10049)The requested address is not valid in its context. : AH00072: make_sock: could not bind to address 255.255.255.255:80 AH00451: no listening sockets available, shutting down
Apache did work when I binded to Internal IP Address, but still I was unable to access landing.mydomain.com from outside the network, it again redirected to my homepage (server localhost)
Listen 255.255.255.254:80
I also received this warning when starting from dos, but it's not the cause of my problems, that's the line I uncommented from httpd.conf cause I read somewhere on boards it helped to some to solve their problems, didn't help me at all, same with commented and uncommented.
Host >>
127.0.0.1 landing.mydomain.com
With this configuration I was unable to access subdomain from localhost. I was still able from outside the network since it was redirect using A record to my server Public Virtual IP.
AH00548: NameVirtualHost has no effect and will be removed in the next release C:/xampp/apache/conf/extra/httpd-vhosts.conf:19
Solution
So I changed the IP address in host file also to Internal IP Address, 255.255.255.254
255.255.255.254 landing.mydomain.com
And left the vhost as.
NameVirtualHost localhost:80
<VirtualHost localhost:80>
DocumentRoot C:/xampp/htdocs/
ServerName localhost
ServerAlias localhost
</VirtualHost>
<VirtualHost landing.mydomain.com:80>
DocumentRoot "C:/xampp/htdocs/landing"
ServerName landing.mydomain.com
ServerAlias landing.mydomain.com
</VirtualHost>
If someone is familiar with configuration of Apache on Windows Server 2012 please any help is appreciated :)
Update
I forgot to mention you should not forget to configure Windows Server Firewall (allow on ports 80 and 443, tcp incoming traffic) as well as endpoints (tcp 80 and 443) on Azure platform.