ruby-on-rails - 当我从 Rails Guide 添加 Far-Future Expires 子句时,Apache 崩溃

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

根据 this 尝试使用 Apache 为我的预编译 Assets 提供服务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 服务器将不会启动。我究竟做错了什么?

最佳答案

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

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



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

关于ruby-on-rails - 当我从 Rails Guide 添加 Far-Future Expires 子句时,Apache 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11617861/

相关文章:

ruby-on-rails - 更改设备注册路径

ruby-on-rails-3 - 使用ubuntu在monit下运行delayed_job

ruby-on-rails - session 可以在Heroku上与多个Web dynos一起使用吗?

ruby-on-rails - 如何在 Rails 3 中制作自定义助手?

python - Django + Anymail + Mailgun Webhook => META 中没有 HTTP_AUTHORIZATION

ruby-on-rails - 从Ruby on Rails中的模型和 View 进行逆向工程(生成)表或数据库模式

javascript - 错误 : It isn't possible to write into a document from an asynchronously-loaded external script

apache - 在 ec2 亚马逊实例上的 ubuntu 服务器上安装了灯,仍然无法通过运行 apache 的浏览器访问服务器。为什么?

PHP tmux 和 screen 行为不正确(没有启动,没有新 session ,没有新窗口)

ruby-on-rails - 使用 has_secure_password 获取密码不能为空