|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Hosting domains on one IP address
Probably, I’m not saying this right on the heading, because when I search everywhere my problem is a little bit different than is explained anywhere else.
This is my dilemma: I have 3 fixed IP addresses (200.142.9.xxx, 200.142.9.yyy, 200.142.9.zzz), 3 different domain names (abc.com, xyz.com, pqr.com) which are working well within my DNS / Web server Setup. Here it is for abc.com: ; ; Database file abc.com.dns for abc.com zone. ; Zone version: 1 ; @ IN SOA mywebserver.mydomain.com. admin.mydomain.com. ( 1 ; serial number 900 ; refresh 600 ; retry 86400 ; expire 3600 ) ; minimum TTL ; ; Zone NS records ; @ NS mywebserver.mydomain.com. ; ; Zone records ; @ A 200.142.9.xxx @ MX 10 mail.mydomain.com. mail A 200.142.9.xxx ns1 A 200.142.9.xxx ns2 A 200.142.9.xxx www A 200.142.9.xxx This is the same for xyz.com and pqr.com, except with different IP addresses. My company would like to use the 3 domains within one IP address and use the other 2 for different purposes. How can I run all 3 domains in one IP address? Can anyone help me? Thanks in advance. ITmax.
__________________
max |
|
#2
|
|||
|
|||
|
Yes, you can definitely do this
Setting up the DNS for this is easy. Put in A entries pointing all the domains to the one IP you want to use. Put in MX records, too, because otherwise some MTAs will have problems. Do not forget reverse DNS. Be careful about how you configure reverse DNS otherwise some sites (like AOL) will silently drop your outgoing email.
Setting up the applications is more tricky. With Apache, use the VirtualHost directive in httpd.conf. There is an example in the file which should show you how to do it. You'll also need to set up your MTA. I use Postfix, and in postfix, you'll use the mydestination directive and the relayhost directive to make it work. I have no idea how to do this in sendmail, but it is definitely possible. It's probably not possible with some other, older protocols like ftp. ------------ WAP hosting Last edited by ChiralSoftware : March 10th, 2004 at 12:44 AM. |
|
#3
|
||||
|
||||
|
Is this a trick question or something? Just change all the IP's in all files so that they are all the same.
__________________
Send me a private message if you would like me to setup your DNS for you for a price of your choosing. This is the preferred method if your DNS needs to be fixed/setup fast and you don't have the time to bounce messages back and forth on a forum. Also, check out these links: Whois Direct | DNS Crawler | NS Trace | Compare Free DNS Hosts |
|
#4
|
|||
|
|||
|
Sites only work on port 80
first of all this is actually a problem, not a trick question. Silent Rage, tell me why you think that, and maybe i'll be able to prevent that and be more careful with words.
I've sorted out so many problems with your help (silent rage), but i don't know what part of my question upsets you. It could be that I don't know too much about DNS Setup, but somehow my site is working. Please believe me, this is genuine. Now i'll explain the problem: Ok, I don't understand, if I change the same IP address, how will the computer understand the difference between the domain names. I changed them to one IP address, but whatever I set up to port 80 works. For example, I set up abc.com on port 80, even if i type on the browser, xyz.com, it shows abc.com. Where am I going wrong? ITmax |
|
#5
|
|||
|
|||
|
Here's what happens:
First, the client connects to the server. This is a plain old IP connection, based on IP addresses. This connection has nothing to do with DNS. DNS doesn't go anywhere in the IP header, for example. Then, the client sends its request. Its request has two parts: the URI (Uniform Resource Identifier, not the same as a URL), which looks like: /index.php, and a set of headers . One of these headers is the Host: header. So, server has these data to go on:
Technically, the host header field is optional, but I think today basically all browsers and wap wml devices send the Host header field.' Is this beginning to make sense? Apache is very flexible. You can tell it to pick content based on the IP address or the host header. The sanest way to do it (usually) is to use the Host header, which means all you have to do is use name-based virtual hosts. This is easy to do. It is usually set up in the very last section of httpd.conf. There are many tutorials and documentation about this on the web. Feel free to drop me an email if you still can't get it to work. |
|
#6
|
||||
|
||||
|
Actually I think he was asking something else. He was wondering how you can have multiple sites on one IP address.
And your question didn't upset me at all. In a subtle way, I was being rude and insulting your intelligence. Sometimes I can't help myself when somebody asks a seemingly stupid question. But, now I see why you asked it and it is a very good question. This is how a website distinguishes between multiple websites. Below you see part of the RAW data sent to your webserver when somebody goes to http://www.mydomain.com/index.html. GET /index.html HTTP/1.1 Host: www.mydomain.com As you can see the browser is telling you what website it wants to see. The webserver may then look through it's configured "virtual hosts" and choose the first one that matches (in the case of apache). Apache calls this technique "name based hosting" Last edited by SilentRage : January 27th, 2004 at 05:56 PM. |
|
#7
|
|||
|
|||
|
As you guys said, i configured the virtual host. i gave the same ip adress for all of the domains, please correct me if i'm wrong
my files now look like this: ; ; Database file abc.com.dns for abc.com zone. ; Zone version: 1 ; @ IN SOA mywebserver.mydomain.com. admin.mydomain.com. ( 1 ; serial number 900 ; refresh 600 ; retry 86400 ; expire 3600 ) ; minimum TTL ; ; Zone NS records ; @ NS mywebserver.mydomain.com. ; ; Zone records ; @ A 200.142.9.xxx @ MX 10 mail.mydomain.com. mail A 200.142.9.xxx ns1 A 200.142.9.xxx ns2 A 200.142.9.xxx xyz A 200.142.9.xxx abc A 200.142.9.xxx pqr A 200.142.9.xxx www A 200.142.9.xxx I changed the host header name to the relevant domain names. At the same time, I changed the TCP port number to different ones for each domain But now, when I type the domain name into the URL bar, it doesn’t work, but when I add the TCP port number afterwards, then it works How do I overcome this? Can anyone help me? Thanks in advance. Itmax. |
|
#8
|
|||
|
|||
|
Just take out the port numbers
Just take the port numbers out of the host specifications in your httpd.conf file and everything should work.
|
|
#9
|
|||
|
|||
|
Thanks, It works
first of all i'd like to thank all of you guys for your kind help.
but i have to admit, i didn't know where the http.conf file is.... and i still have no clue. but i sort of realized from ChiralSoftware's reply that if i changed all the ports to 80 then it would work, and it does. but is this ok? are there any security risks involved? now, for my personal knowledge, i would like to know, where is that file?!(http.conf) and if i want to publish my sites via different ports then what do i have to do? i know you're all gonna despise me with a passion after this... but anyway... i didn't ask you this in the first place because i thought that all the information in one all messed up would confuse you. If i want to publish sites on say for example news.abc.com (it's called subdomain isn't it?) so.. yet again...How do I do it? I have all the pages related to news in the news directory, i want it to be available if the user types in news.abc.com so can you help me....again |
|
#10
|
|||
|
|||
|
http.conf and security
httpd.conf is the file you should have been editing to set port numbers. I'm not sure which other file you could edit to do that, unless you are using some kind of GUI configuration tool which handles it automatically.
Anyway, httpd.conf could be located in several different places, depending on how Apache is installed. If you downloaded and compiled Apache 1.3, it would be in /usr/local/apache/conf by default, but with any of the standard Linux distros, it will be somewhere else, probably somewhere under /etc. Security: There could be security implications for running multiple domains on one site. It depends on what you are doing and how you are doing it. Let's say you have some kind of web application that allows customers to log in, and it uses cookies. If you are not careful, it is possible that a customer could log in to xyz.com, get the necessary cookie, and then move over to abc.com without having to log in, and still use the same cookie, even though he is not authorized to use abc.com. It is something to think about, and you may want to get some expert advice on it if you are doing something like that. |
|
#11
|
||||
|
||||
|
if you're using microsoft's IIS then you don't have a httpd.conf. And as far as security goes, you're in trouble.
|
![]() |
| Viewing: Dev Shed Forums > System Administration > DNS > Hosting domains on one IP address |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|