8

I want to create a virtual host in apache such that it serves only static content like stylesheets, videos, images, javascripts, text files, etc. I am not looking at any "processing" capabilities from this virtual host.

deostroll
  • 11,661
  • 21
  • 90
  • 161
  • To extend the question, a good answer would include directives "to inform the browser to keep files in its own cache" and "to have be cookieless requests". – SandRock Dec 21 '10 at 16:18

1 Answers1

11

Create a VirtualHost entry as follows:

<VirtualHost *:80>
    ServerAdmin admin@domain.tld
    ServerName media.domain.tld

    DocumentRoot "/Library/WebServer/Documents/media"

    ErrorLog "/private/var/log/apache2/media-error_log"
    CustomLog "/private/var/log/apache2/media-access_log" common

    <Directory /Library/WebServer/Documents/media>
    Order deny,allow
    Allow from all
    SetHandler default-handler
    </Directory>

</VirtualHost>
viam0Zah
  • 25,949
  • 8
  • 77
  • 100