Force apache to server different directories on different ports?

Solution 1:

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.

Solution 2:

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>