jake
jake

Reputation: 1691

Apache crashing when I add Far-Future Expires clause from Rails Guide

In an attempt to serve my precompiled assets with Apache, per this Rails Guide I try to change this:

<VirtualHost *:82>
  ServerName localhost
  DocumentRoot "C:/RubyStack-3.2.5-0/projects/release_checklist/public"
  <Directory "C:/RubyStack-3.2.5-0/projects/release_checklist/public">
    Allow from all
    Options -MultiViews
  </Directory>
  ProxyPass / http://localhost:3001/
  ProxyPassReverse / http://localhost:3001/
  ProxyPreserveHost On  
</VirtualHost>

To this:

<VirtualHost *:82>
  ServerName localhost
  DocumentRoot "C:/RubyStack-3.2.5-0/projects/release_checklist/public"
  <Directory "C:/RubyStack-3.2.5-0/projects/release_checklist/public">
    Allow from all
    Options -MultiViews
  </Directory>
  ProxyPass / http://localhost:3001/
  ProxyPassReverse / http://localhost:3001/
  ProxyPreserveHost On

  <LocationMatch "^/assets/.*$">
    Header unset ETag
    FileETag None
    # RFC says only cache for 1 year
    ExpiresActive On
    ExpiresDefault "access plus 1 year"
  </LocationMatch>
</VirtualHost>

in my httpd.conf file. However, the Apache server won't start when the second option has been added. What am I doing wrong?

Upvotes: 4

Views: 6922

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

What error does it give you? Are you sure you have mod_expires compiled into apache and that the module is loaded?

Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration

Yeah, that's usually the error you get if you use a directive that's mapped to a module that isn't loaded (or just a mispelled directive, which appears the same to apache). You'll need to check httpd.conf and make sure the LoadModule expires_module modules/mod_expires.so line is not commented out, of if it's missing, to add it. Depending on your apache's version, the line can be slightly different.

Upvotes: 12

Related Questions