I want to put expiration setting similar to mentioned here. Apache caching with mod_headers mod_expires
However I am not sure where should I put that code. I am running apach2 on ubuntu and I have 4 vhost in my apache. A vhost config is something similar to this one
<VirtualHost xx.xx.xx.xx:80>
ServerName xxxxxx
ServerAlias xxxxxxxxxx
DocumentRoot /home/xxxx/current/public
<Directory "/home/xxx/current/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
My gut feeling is that I should put stuff after the end of directory. That would be after this tag . Is that the right place to put the expiration code.
And I am also assuming that I would be repeating the same code for all 4 vhosts. They all need same configuration.
Best Answer
You can put it anywhere inside
<VirtualHost>
. So after<Directory>…</Directory>
is fine, as is before it, or betweenServerName
andServerAlias
, etc.You can probably put it outside the vhost as well, in which case it'll apply to all vhosts (but I'm not completely sure on this).