I am trying to port to nginx from Apache using Passenger in both instances to host a Rails application. The application accepts the request, which is intended for the image, if the image exists in / system / logos / $ requestimage, then it must be serviced, or it must be allowed to get into the Rails application to generate it if necessary (where it is then cached to / system / logos).
In Apache, I used the following:
RewriteCond %{DOCUMENT_ROOT}/system/logos/%{REQUEST_FILENAME} -f
RewriteRule ^/(.*)$ http://assets.clg.eve-metrics.com/system/logos/$1
Everything went perfectly. Assets. subdomain is another subdomain, but with the same root, only a disabled Passenger, specially configured to host static files (after expiration).
In nginx, I use the following:
server {
listen 80;
passenger_enabled on;
server_name clg.eve-metrics.com www.clg.eve-metrics.com;
root /opt/www/clg/current/public;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/xml text/css application/javascript;
gzip_disable msie6;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
if (-f $document_root/system/logos$request_filename) {
rewrite ^/(.*)$ http://assets.clg.eve-metrics.com/system/logos/$1 break;
}
}
. . , Rails. nginx, , , . , ?