Koozali.org: home of the SME Server

Need help with htacess, headers & apache modules

Paul

Need help with htacess, headers & apache modules
« on: November 06, 2002, 02:59:24 AM »
.. help..


I am running 5.5 with Post Nuke.  I have found that my pages [particularly .gifs] are being cached by my isp.

I just started my research and have discovered that I need to use http headers.  I was wondering if Esmith 5.5 has the two modules they say I need -- module=expires and module=headers, and if not..how do I install, configure, etc. them to accomplish my goal.  I want to force no caching on my sites -for now.

There was also some reference to htaccess to help with this caching issue to.

I really need help with this guys... and i'm sure someone else out there will to.  I am not an expert with any of this stuff but can follow good directions.

I have not run into many good articles on this yet but here is one for starters:

http://www.mnot.net/cache_docs/

Nathan Fowler

Re: Need help with htacess, headers & apache modules
« Reply #1 on: November 06, 2002, 05:27:06 PM »
Mod_expires:  http://httpd.apache.org/docs/mod/mod_expires.html
Mod_headers:  http://httpd.apache.org/docs/mod/mod_headers.html

You're going to need to compile and install the modules.  Look at my available modules (I'm 4.1.2) using I see that I do have mod_expires installed, and this is a module I did not install myself.

"mod_ssl, mod_php4, mod_bandwidth, mod_gzip, mod_setenvif, mod_so, mod_usertrack, mod_headers, mod_expires, mod_digest, mod_auth_external, mod_auth_db, mod_auth_anon, mod_auth, mod_access, mod_rewrite, mod_alias, mod_proxy, mod_userdir, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod_negotiation, mod_mime, mod_log_referer, mod_log_agent, mod_log_config, mod_env, http_core"

mod_expires may do what you need it to, you may not need to install mod_headers.  In the mod_expires documentation it lists specific expiry commands to affect .gif images, you could use the below command to expire after access.

ExpiresByType image/gif "access plus 5 seconds"

This would expire type .GIF after 5 seconds have passed after access.

These rules must be added to /etc/httpd/conf/httpd.conf

I assume you want to do this for all sites, so you could do a "server config" context.

Follow these steps to implement mod_expires on a global scale, for all vhosts.

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
pico -w /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/45Mod_Expires

[Add the following lines]
# Mod_expires configuration
# Expire documents by type or access
ExpiresActive on
ExpiresDefault "access plus 12 hours"
ExpiresByType image/gif "access plus 5 seconds"
ExpiresByType image/html "access plus 5 minutes"
[Save changes]

/sbin/e-smith/expand-template /etc/rc.d/init.d/httpd restart
/etc/rc.d/init.d/httpd restart


You should now be expiring documents based on the above rules.  For more information and the configuration of Mod_expires please reference the above URL.

Hope this helped,
Nathan

Paul

Re: Need help with htacess, headers & apache modules
« Reply #2 on: November 06, 2002, 06:34:27 PM »
Thanks you for your response.  I created the diretory and file that you suggested.

I then typed the:


[root@mcn root]# /sbin/e-smith/expand-template /etc/rc.d/init.d/httpd restart

and this was the system response:

No templates were found for //etc/rc.d/init.d/httpd.
 at /usr/lib/perl5/site_perl/esmith/util.pm line 88

So I am stuck on this part.  Did I screw something up?

Nathan Fowler

Re: Need help with htacess, headers & apache modules
« Reply #3 on: November 06, 2002, 06:38:10 PM »
Sorry, I was multi-tasking and I typod.

/sbin/e-smith/expand-template /etc/rc.d/init.d/httpd restart

Should read as:
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf

Paul

Re: Need help with htacess, headers & apache modules
« Reply #4 on: November 06, 2002, 06:54:21 PM »
Ok.. no errors.. I will take a look at whats published now..  

One more quick question... how do I run a command to see what modules I have
installed.... thank you VERY much.

I will let you know how this works out.

Thanks again,

Paul

Nathan Fowler

Re: Need help with htacess, headers & apache modules
« Reply #5 on: November 06, 2002, 07:01:41 PM »
I simply create a .php file in an HTML directory that has PHP enabled.  An IBAY for instance.

pico -w info.php
[Add the lines]

[Save]

Then, just http://www.mydomain.com/info.php

Hope this helped,
Nathan