Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 254
jake Avatar asked Dec 20 '22 18:12

jake


1 Answers

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.

like image 81
Jon Lin Avatar answered Dec 23 '22 08:12

Jon Lin