2 Different Websites on 1 server?

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

2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 14:04

First of all, this is my 1st post here, i am sorry if this is not the place to ask. :?:
So i have 2 domains, Which are: clarkycal.com and cpgaming.co.uk
Right now there are both pointed to the same website, aka if you goto clarkycal.com it will be the exact same a cpgaming.co.uk.
How do i create 2 websites on the one server, i tried a lot of guides for "Made up" domain and you change in the host file but that doesn't make sense if i have REAL domains... Both domains are from 1and1, but cloudflare has the name servers as i'm using them for security and dns.. But i have a feeling that i can't use cloudflare with the way i want things to go.
Conclusion: i have 2 REAL domains from 1and1 and i want a website for each domain however on the same server.

thank you for anyone who helps out!
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 JJ_Tagy » 11. June 2017 19:48

You are looking for virtualhost setup. There are some posts here or on Google that can explain what that is and how to set it up.
JJ_Tagy
 
Posts: 727
Joined: 30. January 2012 13:44
Operating System: Windows 10 Pro x64

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 20:29

JJ_Tagy wrote:You are looking for virtualhost setup. There are some posts here or on Google that can explain what that is and how to set it up.

Hello, i specified in my post i have tried many guides and didn't get where i wanted. Honestly telling someone to google something in a community forums is kinda useless! But thanks for the input. :roll:

Maby i shall give more info on what i have tried?
This is my virtualhost file for my 2 domains:
Code: Select all
<VirtualHost *80>
    ServerAdmin webmaster@clarkycal.com
    DocumentRoot "C:/xampp/virtual/clarkycal.com"
    ServerName www.clarkycal.com
    ErrorLog "logs/clarkycal.com-error.log"
    CustomLog "logs/clarkycal.com" common
   
   <Directory "C:/xampp/virtual/clarkycal.com">
   #Options Indexes
    AllowOverride all
    Order Deny,Allow
    Allow from all
    Require all granted
   </Directory>
</VirtualHost>

<VirtualHost *80>
    ServerAdmin webmaster@cpgaming.co.uk
    DocumentRoot "C:/xampp/virtual/cpgaming.co.uk"
    ServerName www.cpgaming.co.uk
    ErrorLog "logs/cpgaming.co.uk-error.log"
    CustomLog "logs/cpgaming.co.uk" common
   
   <Directory "C:/xampp/virtual/cpgaming.co.uk">
   #Options Indexes
    AllowOverride all
    Order Deny,Allow
    Allow from all
    Require all granted
   </Directory>
</VirtualHost>


Now this seems to do nothing at all... Is there something im missing? This is where i thought cloudflare would be interfering but i don't know..
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 Altrea » 11. June 2017 20:44

Hi,

clarkycal wrote:i specified in my post i have tried many guides and didn't get where i wanted. Honestly telling someone to google something in a community forums is kinda useless! But thanks for the input. :roll:

Honestly, blaming somebody giving you unspecific replies because you are not able or willing to give specific information yourself is not the best way to getting help.

clarkycal wrote:Now this seems to do nothing at all... Is there something im missing?

Do you think that this is a detailed report? No, it's not.
Did you restart your Apache after that changes?
Is the ServerName you specified correct (the same ServerName you used in your browser, e.g. omitting www. at the biginning will not work)?
Is there any information in the Apache logs?
Are there any rewrites or redirects defined on your system?

There are plenty of information you could give which can be helpful. Be as detailed as possible.
What do you do, what do you expect, what do you get as response.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8964
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 21:13

Altrea wrote:Honestly, blaming somebody giving you unspecific replies because you are not able or willing to give specific information yourself is not the best way to getting help.

I wasn't coming to be hostile so chill out, i apologise if i did..

Altrea wrote:Did you restart your Apache after that changes?

Of course!
Altrea wrote:Is the ServerName you specified correct (the same ServerName you used in your browser, e.g. omitting www. at the biginning will not work)?

Indeed it makes no difference i have tried both.
Altrea wrote:Is there any information in the Apache logs?

No there isn't, i don't think there is an error anywhere..
Altrea wrote:Are there any rewrites or redirects defined on your system?

Ah! Well like i said i am running cloudflare as a dns server and all, and it redirects http to https..
Altrea wrote:There are plenty of information you could give which can be helpful. Be as detailed as possible.
What do you do, what do you expect, what do you get as response.

I don't know what information to give! I mean, also like i said in my original post both domains are using the same directory so they both read the same files.. and still do, and the vhosts file is 100% uncommented in the config.
Like i said i didn't mean to be hostile..
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 JJ_Tagy » 11. June 2017 21:25

clarkycal wrote:i specified in my post i have tried many guides and didn't get where i wanted. Honestly telling someone to google something in a community forums is kinda useless!

Not really. You didn't specify what guides and you never said Google. Also, if you re-read my post, I also said here which must mean only Google to you. :roll: Good luck.
JJ_Tagy
 
Posts: 727
Joined: 30. January 2012 13:44
Operating System: Windows 10 Pro x64

Re: 2 Different Websites on 1 server?

Postby Altrea » 11. June 2017 21:27

clarkycal wrote:Ah! Well like i said i am running cloudflare as a dns server and all, and it redirects http to https..

HTTPS is using port 443 by default. Your VirtualHosts only matching for port 80.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8964
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 21:34

Altrea wrote:HTTPS is using port 443 by default. Your VirtualHosts only matching for port 80.

Well i just tried 443 (Restarting apache) and no luck, however this error:
--Snipped that code out as i noticed the error was my bad..--

But what i don't understand is both domains are still using the default htdocs directory..
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 21:37

clarkycal wrote:Now this seems to do nothing at all...


Still not? Because its working perfectly for me. If I enter http://www.clarkyal.com into my browser, it redirects to https://www.clarkyal.com and shows a little "Coming soon" screen with a footer saying "This will be dedicated to clarky's work. (Software Development)". Same for http://www.cpgaming.co.uk also redirects to https:... and also shows up "Coming soon". I think thats you want to achieve?!
Nobbie
 
Posts: 9770
Joined: 09. March 2008 13:04

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 21:40

Nobbie wrote:
clarkycal wrote:Now this seems to do nothing at all...


Still not? Because its working perfectly for me. If I enter http://www.clarkyal.com into my browser, it redirects to https://www.clarkyal.com and shows a little "Coming soon" screen with a footer saying "This will be dedicated to clarky's work. (Software Development)". Same for http://www.cpgaming.co.uk also redirects to https:... and also shows up "Coming soon". I think thats you want to achieve?!


Right! But unfortunately, i want them to use there own directory.. So i want cpgaming.co.uk to use the directory "C:/xampp/virtual/cpgaming.co.uk" and clarkycal.com to use "C:/xampp/virtual/clarkycal.com" however they both still use htdocs folder..
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 21:51

Which Apache configuration are you showing? If I do "ping www.clarkycal.com", the system tells me that the corresponding IP is 104.31.68.245. If I do a "ping www.cpgaming.co.uk", it tells me the IP 104.31.64.86. So this are TWO DIFFERENT IPs!

There is something wrong with your DNS, both Domains should point to one IP and both to the IP of your Xampp Server. What is the public WAN IP of your Xampp? Or is it behind a router? Then tell us the WAN IP of your router. I think you are doing something totally wrong. You set up namebased VirtualHosts, but the Servers have different IPs, that does not fit together.
Nobbie
 
Posts: 9770
Joined: 09. March 2008 13:04

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 21:58

Nobbie wrote:Which Apache configuration are you showing? If I do "ping http://www.clarkycal.com", the system tells me that the corresponding IP is 104.31.68.245. If I do a "ping http://www.cpgaming.co.uk", it tells me the IP 104.31.64.86. So this are TWO DIFFERENT IPs!

There is something wrong with your DNS, both Domains should point to one IP and both to the IP of your Xampp Server. What is the public WAN IP of your Xampp? Or is it behind a router? Then tell us the WAN IP of your router. I think you are doing something totally wrong. You set up namebased VirtualHosts, but the Servers have different IPs, that does not fit together.

Well that is "CloudFlares" Addresses.. This is where in thought clouldflare was going to be the problems... It's a security thing that cloudflare does? I have a feeling im gonna have to leave cloudflare for this to work. hold on i will try to mess with cloudflares settings..
Edit: So after "pausing" cloudflare and disabling HTTPS redirects, still nothing.
Edit2: Now if you check the ip's they both should show the same, however i don't think that's linked to the problem.
Last edited by clarkycal on 11. June 2017 22:08, edited 1 time in total.
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:08

I cannot help you on cloudflare, as i have no idea what you are doing there and which role cloudflare plays here?! Youre DNS setup seems to be wrong, i still dont know the IP of your Xampp PC or Router. I even dont know if you are running Xampp behind a router, if you have a fixed IP (or, like many providers do) a "dynamic" IP (mostly changing every 24 hours) or what. Its impossible to help with such a lack of information.
Nobbie
 
Posts: 9770
Joined: 09. March 2008 13:04

Re: 2 Different Websites on 1 server?

Postby clarkycal » 11. June 2017 22:12

Nobbie wrote:I cannot help you on cloudflare, as i have no idea what you are doing there and which role cloudflare plays here?! Youre DNS setup seems to be wrong, i still dont know the IP of your Xampp PC or Router. I even dont know if you are running Xampp behind a router, if you have a fixed IP (or, like many providers do) a "dynamic" IP (mostly changing every 24 hours) or what. Its impossible to help with such a lack of information.

Right i'm sorry, I should have probably said that my xampp server is home hosted so yes, it's behind a router, i use cloudflare for DNS and i guess security benefits?
i don't understand why you want my ip so bad? but here it is, 77.97.235.146, the ip is fixed and all, im sorry i dont know what else to say
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:17

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....
Nobbie
 
Posts: 9770
Joined: 09. March 2008 13:04

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 68 guests