根据 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/