Ruby on rails 在Rails指南中添加Far Future Expires子句时Apache崩溃

Ruby on rails 在Rails指南中添加Far Future Expires子句时Apache崩溃,ruby-on-rails,ruby-on-rails-3,apache,Ruby On Rails,Ruby On Rails 3,Apache,为了使用Apache为我的预编译资产提供服务,根据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

为了使用Apache为我的预编译资产提供服务,根据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>

服务器名本地主机
DocumentRoot“C:/RubyStack-3.2.5-0/projects/release\u checklist/public”
通融
选项-多视图
ProxyPass/http://localhost:3001/
ProxyPassReverse/http://localhost:3001/
代理主机
为此:

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

服务器名本地主机
DocumentRoot“C:/RubyStack-3.2.5-0/projects/release\u checklist/public”
通融
选项-多视图
ProxyPass/http://localhost:3001/
ProxyPassReverse/http://localhost:3001/
代理主机
标题未设置ETag
FileTag无
#RFC表示缓存只能使用1年
过期于
ExpiresDefault“访问权限加1年”

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

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

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


是的,如果您使用映射到未加载模块的指令(或者只是一个错误的指令,对apache来说是一样的),通常会出现这种错误。您需要检查httpd.conf并确保
LoadModule expires\u modules/mod\u expires。因此,
行没有注释掉,如果缺少,则添加它。根据您的apache版本,该行可能略有不同。

它会给您带来什么错误?您确定已将mod_expires编译到apache中,并且模块已加载吗?我唯一能看到任何错误的方法是在Windows事件日志中;命令行和gui启动器以静默方式失败。事件日志报告了以下错误:名为的Apache服务报告了以下错误:>>>C:/RubyStack-3.2.5-0/apache2/conf/httpd.conf的第520行出现语法错误:“ExpiresActive”命令无效,可能是由于服务器配置中未包含的模块拼写错误或定义错误mod_expires模块确实被注释掉了。作为ApacheNoob的结果,Rails指南假设我知道该怎么做--服务器现在运行正常,感谢您的帮助!如果你把答案贴出来,我会接受的。