PDA

View Full Version : ispconfig3 Multiple Sites (Domains) in one Server


dcarlos
14th March 2009, 06:52
I'm trying to figure out how to use ispconfig3 to host two different Sites (Domains) in a single Server.

First of all I should say I'm not a server admin expert :)

I can add the two Sites, for example:
www.mydomain1.com and www.mydomain2.com

However this seams to generate two equal VirtualHosts in the httpd configuration.
mydomain1.com.vhost:
...
<VirtualHost *:80>
...

mydomain2.com.vhost:
...
<VirtualHost *:80>
...
In apache one will overlap the other, right?
Am I supposed to use Virtual IP addresses to do this?

Shouldn't ispconfig3 use domain names in the VirtualHost directive instead of ip addresses?
If so we would have:
<VirtualHost mydomain1.com:80>

Thanks in advance,
duarte

till
14th March 2009, 11:55
Just click on new domain, enter the domain and click on save. You can add hundreds or thousands of domains like this to the same server.

However this seams to generate two equal VirtualHosts in the httpd configuration.

No. They are not equal as the domain of the vhost does not has to be set in the virtualhost directive. Just try it and you see that it works.

In apache one will overlap the other, right?

No.

Am I supposed to use Virtual IP addresses to do this?

No.

Shouldn't ispconfig3 use domain names in the VirtualHost directive instead of ip addresses?

No.

dcarlos
15th March 2009, 03:42
Correct. Thanks for the help!

OvrFlote
18th June 2009, 16:12
I came to this forum for some help and found this thread. It seemed to be right on track with the problem I am having, but his issue seems to be resolved and I'm still having the issue.

I installed ispconfig3 over opensuse 11.1 on an old box I had laying around.
I have 2 domain names from dyndns.com (one for me, and one for my wife)
I set her site up first everything works great, then I set my site up, and the problem begins.

when i run the command:

/etc/init.d/apache2 restart

this is what i get now:

[Thu Jun 18 07:55:37 2009] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
Syntax OK
Shutting down httpd2 (waiting for all children to terminate) done
Starting httpd2 (prefork) [Thu Jun 18 07:55:38 2009] [warn] _default_ VirtualHost overlap on port 80, the first has precedence

so it seems as though, the original post about the virtualhosts overlapping is true.

so now i recieve the generic ispconfig "Welcome!" when i go to either site. I have racked my brain for months on this so i decided to post.

and if you can't tell I am a Newb. so go easy if i am doing something stupid.:D

till
18th June 2009, 17:12
so now i recieve the generic ispconfig "Welcome!" when i go to either site.

Thats fine as this message is only shown when your sites are working. So now just upload the content of your sites and delete the default index.html file created by ispconfig.

OvrFlote
18th June 2009, 17:23
Ok so this is what I did to fix the issue, hope this helps some other fellow linux newbs.

cd /etc/apache2

vi listen.conf

delete the # in front of "NamedVirtualHost *:80"

==========================================
# Use name-based virtual hosting
#
# - on a specified address / port:
#
#NameVirtualHost 12.34.56.78:80
#
# - name-based virtual hosting:
#
NameVirtualHost *:80
#
# - on all addresses and ports. This is your best bet when you are on
# dynamically assigned IP addresses:
#
#NameVirtualHost *
===============================================

Then,

cd vhosts.d
cp vhost.template YourDomain1.com.conf
cp vhost.template YourDomain2.com.conf
vi YourDomain1.com.conf

Now, you need to replace all the "dummy-site.com's" with YourDomain1.com, but that is it, do not uncomment anything unless you know what you are doing.

vi YourDomain2.com.conf

Now, you need to replace all the "dummy-site.com's" with YourDomain2.com, but that is it, do not uncomment anything unless you know what you are doing.

Finally, restart apache

/etc/init.d/apache2 restart

you should see

Syntax OK
Shutting down httpd2 (waiting for all children to terminate) [my wife hates that terminology, lol]
Starting httpd2 (prefork)

there should not be anymore overlapping errors.

this is my own newb strategy and it worked for me, I now have two sites running on one server with one ip.

My setup is the perfect server opensuse 11.1 ispconfig 3 [thank you sourceforge]

my question is, why doesn't ispconfig 3 do this automatically??

Anyway, hope this helps someone. thanks again everyone.

OvrFlote
18th June 2009, 17:27
Thats fine as this message is only shown when your sites are working. So now just upload the content of your sites and delete the default index.html file created by ispconfig.

well, the problem was that my wife's site was setup and working fine (with content), but upon me adding my site VIA ispconfig 3, did both pages start showing the same default "Welcome!" html.

it was because apache2 was defaulting to serving only one site on both domains.

till
18th June 2009, 17:29
ISPConfig uses the directory sites-enabled and not vhosts.d. You will find all vhosts in the sites-eanbled subdirectory. The directory vhosts.d must be empty or ispconfig will not work properly anymore.

If the vhost files are not in the directory sites-enabled then there is aerror in your configuration and you have to check the mintor why the files could not be written.

OvrFlote
18th June 2009, 17:45
Right, and the .vhost files are in the sites-enabled directory, but it did not work that way for me.

in the vhosts.d directory, there are not .vhost files but they are .conf files.

and please advise how to fix the issue because i do not want to lose anything or break my ispconfig 3 setup.

simply adding the sites through ispconfig admin panel does not work on my setup. I was only able to host one site before i did what was in the other post.

is there settings i can post from my server so that you could tell me where I am going wrong?

till
18th June 2009, 17:57
1) Delete all files in vhosts.d directory.
2) Did you select * or the IP address for the sites in the ispconfig settings?
3) Make sure that all domains point with a dns A-Record to your server IP. Dont use any redirects.

OvrFlote
18th June 2009, 18:15
1) Delete all files in vhosts.d directory.

done, and restarted apache2, and everything still looks ok now, could my problem have been in the listen.conf file by just uncommenting the NamedVirtualHost *:80 line? when this was not uncommented i was getting the default page on both sites. that seems to be the issue. I just commented it and restarted apache and got the previous errors and both sites defaulted again. so I uncommented that line restarted apache and both sites are back to normal. Amazing.

2) Did you select * or the IP address for the sites in the ispconfig settings?

the dropdown only lets me choose *, there are no ip addresses

3) Make sure that all domains point with a dns A-Record to your server IP. Dont use any redirects.

The DNS settings / setup is another struggle entirely for me, absolutely clueless as to how to set this up. If I need to go to another thread for this, please advise.

till
18th June 2009, 18:32
1) Yes, might be the case.
2) IP addresses can be added in the administration module. But as it works now, there is no need to do that. IP addresses are only needed if you want to use e.g. ssl or add an ip based vhost.
3) If the sites work now then DNS is correct. So no need to do anything additionally with DNS.

OvrFlote
18th June 2009, 19:04
so if i wanted to use ssl (probably will) what would i need to do?

OvrFlote
18th June 2009, 19:20
Okay, now we are back to square one, I deleted my site with ispconfig, then readded my site.

both sites are defaulting again, so i checked listen.conf and NamedVirtualHost *:80 is still uncommented

restarted apache and got the following error:

Syntax error on line 70 of /etc/apache2/sites-enabled/kreativkakes.hobby-site.com.vhost:
Invalid command 'ReWriteModule', perhaps misspelled or defined by a module not included in the server configuration


so i edited the vhost at the very bottom and commented out the "ReWriteModule On", then restarted again.

apache started but still getting default on both sites

so when i add a site, apache begins serving only that sites content on all domains. so maybe there is more to the DNS settings that i am just too dumb to figure out.

getting frustrated, please help

dclardy
3rd September 2009, 16:45
I am having the same issue. I added a new domain to my server, and the site caused my other site to go back to the default index file. How do I fix this? I am a complete noob to linux. So please be as thorough as possible?

The sites are drewclardy.info. This one worked fine until I added the new site last night.

Other site is www.clardyfamily.co.cc. It is also pointing to the new site page.

OvrFlote
3rd September 2009, 18:53
I am having the same issue. I added a new domain to my server, and the site caused my other site to go back to the default index file. How do I fix this? I am a complete noob to linux. So please be as thorough as possible?

The sites are drewclardy.info. This one worked fine until I added the new site last night.

Other site is www.clardyfamily.co.cc. It is also pointing to the new site page.

to solve the multiple issues I was having with ispconfig3 among other software, and I hope this doesn't make anyone mad, but I switched to CentOS 5.3, Now EVERYTHING works, no more fighting with OpenSUSE.

Don't get me wrong, if you are a newb, (like myself) there is no other distro you need to be with than openSUSE, I truly believe that suse has user friendly down to a science. It just lacks in certain areas. So i would say, play with suse, get a feel for the power of a linux server, then change to CentOS. some commands are a little different and take a little getting used to. but You will be pleasantly surprised at how easy it is to maintain a cent box (as opposed to Suse.) I was.

In otherwords, i think SUSE is great for desktop environments (winblows replacement OS) but for servers, RedHat has it, hands down. (centos is redhat enterprise, without the support.)

now before anyone starts bashing me, I am a newb as well, and these are just my opinions. You are of course free to choose to stick with suse, but i went down that road faithfully, and you are in for some heartaches with suse as your server if you want to run ispconfig3.

dclardy
4th September 2009, 00:02
I think that I have taken care of the issue that I was having. For some reason, ISPConfig is placing an .html file in the home directory of all the websites when I add a new one. I am having to go in and delete the index.html file that is being written. Is this a none issue?

Thanks.

till
4th September 2009, 00:28
ISPConfig is adding the index.html file into the sites home directory when the site is created. That is the intended behaviour.

OvrFlote
4th September 2009, 00:37
ISPConfig is adding the index.html file into the sites home directory when the site is created. That is the intended behaviour.

Yes we all know the html file is supposed to be created when you add a site.
BUT,
it is not supposed to write that html file into all other previously installed and working sites. causing malfunctions with other sites when you add a new site is, hopefully, not standard procedure.

dclardy
4th September 2009, 00:38
It is doing it to the already established websites.

Say I have website 1. It is up and running.

I go in and add website 2. The server is placing a .html file there. That is fine I understand that action.

It is also adding another .html file in the directory of website 1.

till
4th September 2009, 00:46
Which exact ISPConfig release? There was such a bug in one of the older releases, you should update to 3.0.1.4

dclardy
4th September 2009, 00:52
I am working on that as we speak. I am switching to Debian so we will see how it goes.

Thanks.

tomnhanni
11th September 2009, 14:11
I'm having these same issues.

This is a headless test system which I'm remotely admining. Currently there are no DNS-A records pointing to this machine because I'm planing to move my clients domains to this server if all goes well with ispconfig3.

Suse 11.1

I have 2 clients and each has its own test domain set up.

The hostname of the machine is ie. hostname.com so I want to set up subdomains for testing

client 1 has client1.hostname.com

client 2 has client2.hostname.com

so I checked the sites-available directory and the doc roots are all ok:
client1: --> DocumentRoot /srv/www/client1.hostname.com/web
client2: --> DocumentRoot /srv/www/client2.hostname.com/web

but it still resolves to the first client1 directory and no matter what I type.

ie. http://foo.hostname.com still shows the content from client1 this is frustrating. It is ignoring what i put as documentroot and only resolving the last client that i set up.

Is there some way to test this without having real domains attached to this machine? What I want to do is have all my clients set up with content and fake domains and when I'm ready just move the domain records to my new machine and then just change the domain settings in ispconfig3.

tomnhanni
11th September 2009, 19:35
So i think I figured this one out...

I just made some sites with fake domains then I have to go and manually edit the corresponding sites-available .vhost file and change the ServerName to client1.hostname.com then it works....

The only trouble is everytime I use ispconfig3 to edit a website it writes over my changes in the .vhost file. ::mad:

giftsnake
11th September 2009, 20:06
is there an A record for every subdomain?
is e.g. client1.hostname.com the content of the field 'domain' in the sites tab?

maybe autosubdomain *. is activated for hostname.com?

tomnhanni
11th September 2009, 20:36
The problem is the real domains are running on a different production server.

So I want to set up temporary domains or subdomains on the new box test it out and then tell my ISP to move the domains over to the new box as soon as I'm ready. This is to have little or no downtime.

So what I've done now is go ahead and use the real domains in the sites tab.

This ofcourse wont work because the domains resolve to my other server IP.

So like I said I got it work by maually adding the ServerName in .vhost like this

real-domain.newhost.com which works great.

But ispconfig3 likes to overwrite my manual changes everytime i edit the site in sites tab.

Maybe this helps anyone testing out a new server before moving.

giftsnake
11th September 2009, 20:38
did you create the A record on the productionmachine with the ip from your testbox?

why not use the 'automatic' functions in ispconfig? i dont think it's neccessary to manipulate the vhostfiles...

tomnhanni
11th September 2009, 20:51
did you create the A record on the productionmachine with the ip from your testbox?

I think you are talking about a redirect(I'm still learning all this stuff) if I do that then the domains won't be available on the production machine anymore or? This is bad if something goes wrong on the testmachine...I have to move over 100 domains copying files and MySql databases so it might take some time and possible even some reinstalls if I mess something up. After the 100 domains are setup on the new server I give my ISP the goahead and they move the A records over to my new machine and kill the old box.

So now you see why I have to manually mess with the vhost files.

giftsnake
11th September 2009, 21:00
am i correct in thinkin: you have a domain domain.com on productionmachine and want to move it to testbox, but it should still be available on productionmachine?

maybe you can try this:
create A record with ip from testbox on productionmachine
create aliasdomain for every domain on testbox

no redirect.

tomnhanni
11th September 2009, 22:59
Well that might work but I am not able to create an A record from my production box to a different IP. Only options are redirects so then my domain wont be reachable on the original production box.

But I think this works quite well what I have now.

in ispconfig3 sites tab --> add new website

as domain mydomain.com (the real one)

of course this is not reachable in the browser just the production box.

Then i go in and edit the .vhost file for the mydomain.com on my test box and change the entry ServerName to something like mydomain.testboxhostname.com and I get the test mydomain.com website. Later after my ISP has changed the A record to my test box IP i have to go back and edit the vhost file to ServerName mydomain.com or just save the settings in ispconfig3 and it will write the correct ServerName.