Virtual Hosting with web, ftp, and email

They have: 107 posts

Joined: Mar 1999

I'd like to set up a virtual hosting server, but I only have 1 IP address. Is this possible?

Apache definetely supports virtual hosting with 1 IP address.

ftp also shouldn't be too big of a problem.

My main concern is email. Every source I can find either says more than 1 IP address is needed, or doesn't say at all. It seems like receiving mail for different domain names would be possible. What about sending mail? Do SMTP servers to reverse lookups on IP addresses to make sure the domain name matches? Will this break something if there are multiple domain names for 1 IP address?

Any help is greatly appreciated,
Chris

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

No problem to do.

Your VirtualHost part of httpd.conf will look something like this:
-----------------------------------------------------------
Server configuration:

...
NameVirtualHost 111.22.33.44:80
NameVirtualHost 111.22.33.44:8080

ServerName domain.tld
DocumentRoot /www/domain-80

ServerName domain.tld
DocumentRoot /www/domain-8080

ServerName otherdomain.tld
DocumentRoot /www/otherdomain-80

ServerName otherdomain.tld
DocumentRoot /www/otherdomain-8080

-----------------------------------------------------------

In the above example, they are using the document root of /www. Generally it would be /home/name1, /home/name2, etc.

Generally if you are running on 'Nix box, you would use sendmail as your email server.

Quote: What about sending mail? Do SMTP servers to reverse lookups on IP addresses to make sure the domain name matches?

SMTP servers don't do reverse name lookups.

Quote: Will this break something if there are multiple domain names for 1 IP address?

You won't break anything by doing this. There are some hosts that use Name Based and not IP based virtual hosting.

One of the things that I like best about Apache is it's flexibility.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

They have: 107 posts

Joined: Mar 1999

Thanks for your response.

So you are sure that virtual hosting with one IP address using sendmail will work?

Do you have any references for how to set that up? Thanks and please respond.

Thanks,
Chris

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.