mod_expires and mod_headers.

4 posts / 0 new
Last post
#1 Fri, 12/10/2010 - 09:37
srlabs1

mod_expires and mod_headers.

Hi im new to virtualmin and need some help.

Im trying to get these two modules to work. mod_expires and mod_headers. Centos , virtualmin

I have 3 domains, and they are all working, except for the headers are giving a nocache directive.

these modules are listed in /etc/conf/httpd.conf

and are NOT commented out.

LoadModule expires_module modules/mod_expires.so LoadModule deflate_module modules/mod_deflate.so LoadModule headers_module modules/mod_headers.so

 httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c 

as seen, they will not load by the httpd.conf. Can someone fill me in on how to load those directives. the goal being to Speed Up Sites with htaccess Caching. The Apache docs and everything I can find tells me to uncomment the directives, but that does not work.

Fri, 12/10/2010 - 10:13
andreychek

Howdy,

Well, the -l option shows Apache's compiled in modules. Since the one's you're looking to use are being loaded via the config file, that means they aren't compiled in... so it's normal not to see them in that output.

I believe "httpd -M" would show all modules that have been loaded by Apache.

-Eric

Fri, 12/10/2010 - 10:27 (Reply to #2)
srlabs1

Ok so here is the output you asked for, it looks like the mods are loaded per the httpd.conf yet why would my headers be getting a specific NOCACHE directive, when none is loaded in the .htaccess?

If I were to put this in the .htaccess, would that make these modules load and give me what I am needing?

# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=172800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=60, private, proxy-revalidate"
</FilesMatch>
 httpd -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 file_cache_module (shared)
 mem_cache_module (shared)
 cgi_module (shared)
 version_module (shared)
 fcgid_module (shared)
 perl_module (shared)
 php5_module (shared)
 proxy_ajp_module (shared)
 python_module (shared)
 ssl_module (shared)
 dav_svn_module (shared)
 authz_svn_module (shared)
Syntax OK
Fri, 12/10/2010 - 10:58
andreychek

Yeah, it looks like it's loading okay.

If you take a look at $HOME/logs/error_log, do you see any errors in there that may relate to your htaccess file?

-Eric

Topic locked