Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, say I have my htdocs in:


and those documents are being served on port 80. Is there any way to make apache server documents in:


on a different port? Or does that require a separate instance of apache?

share|improve this question
up vote 12 down vote accepted

It requires a different virtual host.

Just set up two virtual hosts that listen on different ports, let the second have a different document root and forbid access to 'something' within the first.

share|improve this answer
+1 correct - you just need a new vhost with a different docroot – Coops Aug 4 '09 at 20:15
Thanks! I'd vote up, but need 15 reputation before I can. – Mike Trpcic Aug 4 '09 at 20:16
2013 comment!!! – David Houde May 3 '13 at 11:32

Sure, first you'll have to set apache to listen on two ports. So in your httpd.conf set

Listen 80

Listen 8080

Then create two vhost configurations (/etc/apache/sites-enabled/000-default). The first can be *:80 and the second *:8080. Set the respective DocumentRoots.

<VirtualHost *:80>

DocumentRoot ~/public_html

Blah Blah....



<VirtualHost *:8080>

DocumentRoot ~/public_html/something

Blah Blah....


share|improve this answer
Wow, you took Manni's answer a step further. Thanks for the example config stuff, it's very helpful. Sorry I can't upvote, but I will when I get 15 reputation! – Mike Trpcic Aug 4 '09 at 20:17

Your Answer


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.