Setting up a subdomain on my local server

They have: 850 posts

Joined: Jul 1999

I just installed linux on an old computer. I am playing around with apache now. I am running just a local server right now (127.0.0.1)

I want to set-up a subdomain now. I tried the following by editing httpd.conf

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
ServerName rob.localhost
DocumentRoot /home/rob/public_html
</VirtualHost>

But I cannot access it, I cannot connect at all. I can access it by going to
localhost/~rob though.

Any ideas on what I need to do to get the subdomain working?

Thanks

------------------
Windmills always turn counter-clockwise. Except for the windmills in Ireland.

[This message has been edited by robp (edited 15 February 2000).]

They have: 850 posts

Joined: Jul 1999

I forgot to note that I am using
Apache (default install)
and
RedHat 6.0

------------------
Windmills always turn counter-clockwise. Except for the windmills in Ireland.

They have: 5,633 posts

Joined: Jan 1970

ok, here´s the quick info:

append a line with your domain-name to /etc/hosts like:
www.rob.com 127.0.0.1

Now you should be able to access the first domain by typing www.rob.com in your browser.
Then edit httpd.conf like this

NameVirtualHost 127.0.0.1

<VirtualHost ip.address.of.host.some_domain.com>
ServerAdmin [email protected]_domain.com
DocumentRoot /www/docs/host.some_domain.com
ServerName host.some_domain.com
ErrorLog logs/host.some_domain.com-error_log
CustomLog logs/host.some_domain.com-access_log common
</VirtualHost>

restart apache and there you go
later

Patrick

------------------
Got computer-problems? Don't miss to join our
partner-site at http://www.computer-forums.com

They have: 122 posts

Joined: Jun 2000

Yea, I was just about to say, if you don't have rob.localhost pointing to 127.0.0.1 on the linux machine, you ain't gonna get nowhere. And dont try accessing it from another machine since it's on the loopback device.

Rob Radez
OSInvestor.com

They have: 850 posts

Joined: Jul 1999

Thanks Guys.

I just had to enter the following line to /etc/hosts:

127.0.0.1 rob rob.localhost

roBofh, currently I have no intention for others to access it, since the linux box doesn't have the internet on it. I am just doing this for practice.

------------------
Windmills always turn counter-clockwise. Except for the windmills in Ireland.

They have: 122 posts

Joined: Jun 2000

Just thought I'd mention that since some people with internal networks try to set something like that up and find that it won't work since 127.0.0.1 does not get sent to the right computer...

Rob Radez
OSInvestor.com

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.