Nginx Rule for Rails Application

Use following code for setting up Nginx for rails.

http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;</code>

log_format  main  '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

# Timeouts
client_body_timeout   5;
client_header_timeout 5;
keepalive_timeout     55;
send_timeout          5;

upstream mongrel_cluster {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen       80;
server_name  localhost.localdomain;
#charset koi8-r;
#access_log  logs/host.access.log  main;

#for images routing
location ~* ^/(images|stylesheets|javascripts).+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
root /var/www/html/Projects/Project_Name/public;
}
# concurs with nginx's one

location  / {
proxy_pass	http://mongrel_cluster;
#Fix for host name and redirection to domain

}

}

<code>

You may like following Articles!

  • Pingback: uberVU - social comments

  • http://earn4offer.com Rory Culotta

    I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.

  • http://traffic2website.info Jayson Breitling

    Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!

  • http://symptomsanxiety.info Carrie Smillie

    I’ve been checking your blog for a while now, seems like everyday I learn something new :-) Thanks

  • http://detoxification-diets.info Werner Legoullon

    I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.

  • http://BusinessCardAds.com Inge Ridlen

    Interesting read, perhaps the best article iv’e browse today. We learn everyday cheers to you!