Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

What I need accomplished is when a person out there in internet-land types in www.foo.com they are actually getting served content from srv5.bar.net/~foo

I have root access to both the nameserver ( bind9 ) and the webserver ( apache2 ).

( Yes, I do indeed use sudo rather than running as root )

I already know how to enable the UserDir module to make /home/foo/public_html into srv5.bar.net/~foo which is exactly what I want.

I can also config the A name in dns so that foo.com is by bar.net

I don't know how to make the connection of www.foo.com -> srv5.bar.net/~foo/ I don't even know what this is called to be honest. I don't want to use what I understand to be a cloak that simply puts what I want inside a frame that fills the window.

Just in case it's required, I'm on debian.

share|improve this question
add comment

2 Answers

It's not possible to make the DNS redirect to an specific directory. You have two options.

a. create a redirection from www.foo.com to srv5.bar.net/~foo using index.html

<meta http-equiv="refresh" content="0;URL='http://srv5.bar.net/~foo'">

b. you can setup apache to make /home/foo/public_html be the DocumentRoot for www.foo.com

Default document root for apache2 is /var/www.If you want to change the default document root you need to edit the /etc/apache2/sites-available/default file and look for this line "DocumentRoot /var/www/" here you can change where ever you want to change.For example if you want to change /home/foo/public_html the above line looks like this "DocumentRoot /home/foo/public_html".

share|improve this answer
add comment
up vote 0 down vote accepted

I must apologize for having to ask this question. In my despair, I was able to find the answer... and it was indeed very simple. I wasn't able to close the question sooner though.

Create A name in dns pointing foo.com to bar.net

The magic is taken care of with apache.

Because each server has one public IP assigned to it... I need to use name-based virtual host in apache The info on this for anybody else who is as confused as I was can find it at

This allows one server to handle multiple websites.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.