For example, say I have my htdocs in:

~/public_html

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

~/public_html/something

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

link|improve this question
feedback

2 Answers

up vote 10 down vote accepted

It require 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.

link|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
feedback

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>

and...

<VirtualHost *:8080>

DocumentRoot ~/public_html/something

Blah Blah....

</VirtualHost>

link|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
feedback

Your Answer

 
or
required, but never shown

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