.htaccess and ExpiresActive

software development

#1

I’m trying to improve performance by ensuring a certain directory of images is always cached. The images never change. However, whenever i add the following code to a htaccess file I receive 500 server error:-

ExpiresActive On
ExpiresDefault A18000

Does DH support ExpiresActive? I searched in the wiki but it didn’t reveal anything. If it isn’t supported, can anyone suggest an alternative solution?

I’ve successfully made .htaccess files that work so the problem I’m having is not with my text editor / ftp client etc.

eg a htaccess file with just the following line in it works perfectly:-

Options -Indexes


#2

I haven’t used that, so I won’t be much help on the syntax. The Apache site says it requires mod_expires and a user in this wiki article says DH has that module installed.

If you haven’t already, I’d go ahead and read that Apache page. It’s not long–and there’s also an alternate syntax section, if that helps.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#3

Thanks for the help seiler. I had read the Apache page for guidance when creating the .htaccess page. I’ve now tried the various syntaxes as you suggested but no joy. I’ve noticed just the following line in a htaccess file results in the server 500 errors:-

ExpiresActive On

This leads me to believe something is misconfigured somewhere or DH no longer support mod_expires!? Anyone aware of alternative caching methods at DH?


#4

ecvej,

Well, I got to the bottom of part of the problem, I think. Unfortunately it is not “trivial” to tell what modules are configured for use with an Apache instance on Dreamhost.

If you are running mod_php (which is not supported by default on Dreamhost anymore), phpinfo() will return a list of loaded modules, but php-cgi (which is what most users are now running on DH) will not.

This is further complicated by the fact that Dreamhost is currently running multiple versions of Apache; some users are running Apache 1.3, while others are running 2.0. It also appears that the two versions are not identical as to which modules are loaded.

As a result, I don’t think it is possible to make a general statement as to “what Apache modules are installed” that will be accurate for every user.

Having been here a while, and having “older” domains that are setup running Apache 1.3, as well as newer ones running Apache 2.0, I was able to get a phpinfo() report from both server versions running under mod_php version 4.4.2 and 4.4.4 (even that differs between my Apache’s!)

In the interests of making that information available for others, and to help explain your situation, here is what I found:

[quote]From an Apache 1.3 served domain:

Apache Version: Apache/1.3.37 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.4.4 mod_ssl/2.8.22 OpenSSL/0.9.7e
Apache Release: 10337100
Apache API Version: 19990320

Loaded Modules:
mod_throttle, mod_dav, mod_encoding, mod_setenvif, mod_security, mod_status, mod_rewrite, mod_negotiation, mod_fastcgi, mod_gzip, mod_mime, mod_log_config, mod_include, mod_imap, mod_headers, mod_expires, mod_env, mod_dir, mod_cgi, mod_asis, mod_alias, mod_actions, mod_access, mod_php4, mod_auth_digest, mod_auth, mod_autoindex, mod_dosevasive, mod_ssl, mod_so, mod_log_forensic, mod_define, http_core[/quote]
and

[quote]From an Apache 2.0 served domain:

Apache Version: Apache/2.0.54 (Unix) PHP/4.4.2 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.1.4
Apache API Version: 20020903

Loaded Modules:
core prefork http_core mod_so mod_autoindex mod_auth mod_auth_digest sapi_apache2 mod_access mod_actions mod_alias mod_cgi mod_deflate mod_dir mod_env mod_headers mod_include mod_log_config mod_logio mod_mime mod_negotiation mod_rewrite mod_ssl mod_status mod_suexec mod_fastcgi mod_security mod_setenvif mod_encoding mod_dav mod_dav_fs mod_cband mod_dav_svn mod_authz_svn[/quote]
As you can see, mod_expires is available under the Apache 1.3 configuration, but is not available under an Apache 2.0 configuration.

It appears you are probably running an instance of Apache 2.0. :wink:

You might want to consider whether you want to ask DH to move you to an instance of Apache 1.3 so you can use the mod_expires module, or see if you can get them to enable mod_expires in their configuration of Apache 2.0. I think they should be receptive to enabling mod_expires, as the caching it provides should would make it easier for responsible / considerate users like yourself to cache stuff and decrease the load on the server.

While I know this is not a “fix” for your problem, I hope it helps to understand what is happening (it’s not you :wink: ), and help you decide how to approach the issue.

–rlparker


#5

Thanks rlparker, I am indeed on a 2.x server. I have submitted a request to DH for this mod to be extended to all Apache versions. It’s in their interests as well as ours for it to be enabled but I’ll let you know when I get a reply.


#6

No problem! I hope they implement your request to enable the mod in all Apache versions, and appreciate you letting us know how they respond to your request…

–rlparker


#7

Heres a thought, maybe someone from dh could add a section to the wiki, that tells what mods are loaded for what servers. Maybe in table form.
Silk

My website


#8

DH reply received today:-

[quote]Hello,

I’ll need to look into this for you, and get back to you. sorry about the delay!

Thanks!

Brian[/quote]


#9

[quote]Dreamhost reply:
Hello,

I’ll need to look into this for you, and get back to you. sorry about the delay!

Thanks!

Brian[/quote]
Well, that’s a start…thanks for keeping us up to date. I’ll be interested in any follow-up you receive, :wink:

–rlparker


#10

[quote]Hello,

At this time, we’re still feeling out the possibilities of adding new apache modules, as we have to make sure everything is compatible with our system. If you’d like, I can move you to an apache 1.3 server, so that that module is available to you. If you’d like to do that, please email me

Thanks!

Brian[/quote]


#11

Well, that’s not the most encouraging of answers, now is it? :frowning: .

While it’s nice that they are willing to move you to a Apache 1.3 server so you can use the module, I far rather have the module available from the Apache 2.0 configurations. :wink:

Maybe it’s time to start collecting votes for that to happen via the suggestion system.

–rlparker


#12

Thanks a lot for being so helpful. Best regards for this post.