当我从Rails指南添加Far-Future Expires子句时Apache崩溃

时间:2012-07-23 17:57:15

标签: ruby-on-rails ruby-on-rails-3 apache

尝试使用Apache提供预编译资产时,根据this Rails指南,我尝试更改此内容:

<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>

对此:

<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>

在我的httpd.conf文件中。但是,添加第二个选项后,Apache服务器将无法启动。我做错了什么?

1 个答案:

答案 0 :(得分:7)

它给你带来了什么错误?您确定已将mod_expires编译为apache并且模块已加载吗?

  

无效命令'ExpiresActive',可能拼写错误或由服务器配置中未包含的模块定义

是的,如果你使用一个映射到未加载的模块的指令(或者只是一个错误的指令,看起来与apache相同),通常会出现错误。您需要检查httpd.conf并确保LoadModule expires_module modules/mod_expires.so行没有被注释掉,如果没有,则添加它。根据您的apache版本,该行可能略有不同。