Home : Linux : Servers :
Apache
Cgi Mime Type
I don't know what has changed, or when it changed (v2?), but I've been ignoring the
mod_mime_magic: can't read '/path/foo.cgi'
messages in error.log for some time. They went away when I added
AddType application/x-httpd-cgi .cgi
to httpd.conf.
[ comment | link | top ]
mod_mime_magic: can't read '/path/foo.cgi'
messages in error.log for some time. They went away when I added
AddType application/x-httpd-cgi .cgi
to httpd.conf.
[ comment | link | top ]
Environment Variables
Virtualhost SSL
I don't know what I was doing wrong before but I couldn't get SSL working for VirtualHosts. I don't understand all the ins and outs but the following is working for me... I did run into a problem with multiple hosts until I switched to the same format I use for regular virtual hosts:
NameVirtualHost *:443
<VirtualHost *:443>
</VirtualHost>
<VirtualHost *:443>
</VirtualHost>
[ comment | link | top ]
NameVirtualHost *:443
<VirtualHost *:443>
</VirtualHost>
<VirtualHost *:443>
</VirtualHost>
[ comment | link | top ]
Web Caches
Caching Tutorial for Web Authors and Webmasters
Cacheability Query
Use Server Cache Control to Improve Performance
W3C rfc2616 Cache-Control
Apache 2.2 mod_expires
For better or worse, my setup for static html pages that change with indeterminate frequency is:
ExpiresActive On
ExpiresDefault "access plus 30 days"
[FilesMatch "\.html$"]
Header Set Cache-Control "no-cache, must-revalidate"
[/FilesMatch]
This should cause browsers and proxies to check the modified date on html pages and, if the page has changed, fetch the updated page instead of using the cached page. While it has been reported to help w/ cached pages not being updated, I haven't confirmed its overall effectiveness. While there are occasional changes to images, etc. on my server, they aren't critical and I've decided that a 30 day expiry for all but the html is fine. I apply it as a server-wide default, i.e. its not inside of a directory or VirtualHost block.
...While URL's containing a query (a '?') normally don't get cached, they may be cached (e.g. Explorer browser v6) if Expires and Cache-Control header fields are sent, i.e. if ExpiresActive is on for the directory. This was causing me grief with transitory form field content on cgi generated pages (editing and passing the form field contents back to the same URL would have no effect unless the page was manually reloaded) so I had to add
ExpiresActive Off
to my ExceCgi directory block. Since only Explorer was caching form field content and because it acts appropriately (at least w/ v6, need to check v7) when no expiry and cache-control information is sent in the header (ExpiresActive Off), there was no need to give it specific instructions, e.g.
ExpiresActive On
ExpiresDefault "now"
If Explorers treatment of php query URLs is the same as for cgi, that's fine by me. I now need to figure out how to get all browsers to cache my php generated pages. Serving images from a php gallery gallery script is more server intensive than I'd like. Having those pages cached would lighten the load... I guess the real question is how to selectively cache pages that have a query in their URL.
[ comment | link | top ]
Cacheability Query
Use Server Cache Control to Improve Performance
W3C rfc2616 Cache-Control
Apache 2.2 mod_expires
For better or worse, my setup for static html pages that change with indeterminate frequency is:
ExpiresActive On
ExpiresDefault "access plus 30 days"
[FilesMatch "\.html$"]
Header Set Cache-Control "no-cache, must-revalidate"
[/FilesMatch]
This should cause browsers and proxies to check the modified date on html pages and, if the page has changed, fetch the updated page instead of using the cached page. While it has been reported to help w/ cached pages not being updated, I haven't confirmed its overall effectiveness. While there are occasional changes to images, etc. on my server, they aren't critical and I've decided that a 30 day expiry for all but the html is fine. I apply it as a server-wide default, i.e. its not inside of a directory or VirtualHost block.
...While URL's containing a query (a '?') normally don't get cached, they may be cached (e.g. Explorer browser v6) if Expires and Cache-Control header fields are sent, i.e. if ExpiresActive is on for the directory. This was causing me grief with transitory form field content on cgi generated pages (editing and passing the form field contents back to the same URL would have no effect unless the page was manually reloaded) so I had to add
ExpiresActive Off
to my ExceCgi directory block. Since only Explorer was caching form field content and because it acts appropriately (at least w/ v6, need to check v7) when no expiry and cache-control information is sent in the header (ExpiresActive Off), there was no need to give it specific instructions, e.g.
ExpiresActive On
ExpiresDefault "now"
If Explorers treatment of php query URLs is the same as for cgi, that's fine by me. I now need to figure out how to get all browsers to cache my php generated pages. Serving images from a php gallery gallery script is more server intensive than I'd like. Having those pages cached would lighten the load... I guess the real question is how to selectively cache pages that have a query in their URL.
[ comment | link | top ]