2 Different Websites on 1 server?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 22:24

Nobbie wrote:Did you un-uncomment the file httpd-vhosts.conf in httpd.conf? Per default that file is NOT included in the Apache configuration, there is only a "prepared" include statement in httpd.conf, but it needs to be activated by removing the "#" in the first column.

Of course I need to know, if your IP is REALLY that from your Xampp PC (or Router) or if it points to somewhere else. Its extremely difficult to do a remote debug session and i need to know as much as possible. And now please check if your VirtualHosts are active or if the corresponding file simply is not included....


Yup! It's uncommented:
Code: Select all
# Virtual hosts
Include conf/extra/httpd-vhosts.conf


But hold on, the clarkycal.com is now reading the correct directory, but now cpgaming.co.uk is reading clarkycal.com, i mean we're getting somewhere!
Edit: There both reading there own directory, Honestly i have no idea what fixed it, but thank you so much!
clarkycal
 
Posts: 9
Joined: 11. June 2017 13:57
XAMPP version: php=7.1.1 xampp=3.2.2
Operating System: Windows Server 2012

Re: 2 Different Websites on 1 server?

Postby Nobbie » 11. June 2017 22:30

That usually means that there is something wrong with the VirtualHost definition of cpgaming.co.uk is. In that case Apache simply takes the very first VirtualHost (if there is no VirtualHost for the given Server Name) and thats what just happening. Also keep in mind that you have to define a VirtualHost for "localhost" as well, because the external definition is ignored by Apache if you have VirtualHosts. Having one VirtualHost means, that you have to declare ALL ServerNames you need as VirtualHost. You will see that currently "localhost" will also yield to the definition of http://www.clarkycal.com

If you enter "httpd -S" in a terminal in the Xampp Binary folder (where you find httpd.exe), the Apache will tell you, which VirtualHosts it detects in the configuration. Also check the error_log for any entry.

P.S.: It looks as if you have a VirtualHost for clarkycal.com, but not for http://www.clarkycal.com. Use "ServerAlias" to extend the VirtualHost of clarkycal.com to also use http://www.clarkycal.com
P.P.S.: http://www.clarkycal.com now works also correctly, i had to refresh the browser via Ctrl.+F5
P.P.P.S.: Same thing for the other VirtualHost, now everything runs fine. I think the wrong DNS entry was the main problem, after fixing it, it was only a problem of cached DNS and sites. After refreshing everything runs fine now. Dont forget to setup a localhost VirtualHost!
Nobbie
 
Posts: 9693
Joined: 09. March 2008 13:04

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 22:40

Nobbie wrote:That usually means that there is something wrong with the VirtualHost definition of cpgaming.co.uk is. In that case Apache simply takes the very first VirtualHost (if there is no VirtualHost for the given Server Name) and thats what just happening. Also keep in mind that you have to define a VirtualHost for "localhost" as well, because the external definition is ignored by Apache if you have VirtualHosts. Having one VirtualHost means, that you have to declare ALL ServerNames you need as VirtualHost. You will see that currently "localhost" will also yield to the definition of http://www.clarkycal.com

If you enter "httpd -S" in a terminal in the Xampp Binary folder (where you find httpd.exe), the Apache will tell you, which VirtualHosts it detects in the configuration. Also check the error_log for any entry.

P.S.: It looks as if you have a VirtualHost for clarkycal.com, but not for http://www.clarkycal.com. Use "ServerAlias" to extend the VirtualHost of clarkycal.com to also use http://www.clarkycal.com
P.P.S.: http://www.clarkycal.com now works also correctly, i had to refresh the browser via Ctrl.+F5
P.P.P.S.: Same thing for the other VirtualHost, now everything runs fine. I think the wrong DNS entry was the main problem, after fixing it, it was only a problem of cached DNS and sites. After refreshing everything runs fine now. Dont forget to setup a localhost VirtualHost!

Sir, i would like to thank you for your help, i have just implemented ServerAlias, and all is working, i guess im throwing cloudflare out the window, i'm 99.99% sure that was causing the problem!
Cheers!
clarkycal
 
Posts: 9
Joined: 11. June 2017 13:57
XAMPP version: php=7.1.1 xampp=3.2.2
Operating System: Windows Server 2012

Re: 2 Different Websites on 1 server?

Postby Nobbie » 11. June 2017 23:11

I have no idea what cloudflare does, but obviously it does not play a role in this scenario. You simply need a DNS entry for your both domains, both pointing to your static WAN IP.
Nobbie
 
Posts: 9693
Joined: 09. March 2008 13:04

Previous

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 41 guests