Hi!
I deployed my first rails application on my own server (I’m using Apache
2.2.6 + Mongrel).
It’s working perfectly and I’m very happy.
The only one problem is that it is very slow to render the layout at the
first time. I think that the problem comes from static files like images
and css because the text is rendered directly but images appears one
by one and very slowly.
So I configured my Apache virtual host like this :
<Proxy balancer://myapp_cluster>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
<VirtualHost *:80>
ServerName myapp.com
ErrorLog logs/myapp_errors_log
CustomLog logs/myapp_log combined
DocumentRoot /path_to_app/public
<Directory “/path_to_app/public”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
RewriteEngine On
Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]
Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://myapp_cluster%{REQUEST_URI} [P,QSA,L]
Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
application/xml application/xhtml+xml text/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass /javascripts !
Alias /images /path_to_app/public/images
Alias /stylesheets /path_to_app/public/stylesheets
Alias /javascripts /path_to_app/public/javascripts
And I restarted httpd but it doesn’t seem to change anything.
Am I doing something wrong?
Thanks in advance for your help!