我目前使用Apache代理到Thin(使用这个文章)。
我的静态资源都无法正常工作(例如样式表、JavaScript)。Apache应该为它们提供服务还是我需要在config/environments/production.rb
中启用config.serve_static_assets
?如果Apache应该为它们提供服务,那么我可能做错了什么?
这是我的Apache配置:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/r/public_html/example/public
RewriteEngine On
<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000
BalancerMember http://127.0.0.1:5001
BalancerMember http://127.0.0.1:5002
</Proxy>
# Redirect all non-static requests to thin
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]
ProxyPass / balancer://thinservers/
ProxyPassReverse / balancer://thinservers/
ProxyPreserveHost on
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# Custom log file locations
ErrorLog /home/r/public_html/example/log/error.log
CustomLog /home/r/public_html/example/log/access.log combined
</VirtualHost>