configuring nginx for different rails apps under same domain

Archana Balaji lists at ruby-forum.com
Wed Nov 21 10:10:44 MSK 2007


i want to know how to  configure nginx for different rails app under the
same domain.
for example:
1)Rails application 1 <http://mydomain.com/app1>
2)Rails application 2 <http://mydomain.com/app2>

Below is my enginx configuration .i want to know where iam goin wrong
as i'm able to go in my home page but not able to navigate from login
and signup pages.


NGINX.CONF:


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
    use epoll;
}


http {
    include       conf/mime.types;
    default_type  application/octet-stream;

    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  logs/access.log  main;

    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay    on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types text/plain text/html text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript;

    server_names_hash_bucket_size 128; # this seems to be required for
vhosts


        # mongrel cluster for domain.in
     upstream mongrel_cluster{
                server 127.0.0.1:4000 ;
                server 127.0.0.1:4001 ;
                server 127.0.0.1:4002 ;
                                 }
 #domain.in/app1 server
    server {
        listen       192.168.0.196:80;
        client_max_body_size 50M;
        server_name  www.domain.in domain.in;
        root   /var/www/domain.in/app1/public;
        #charset koi8-r;

        access_log  logs/access.log  main;
        rewrite_log on;

        location /app1/ {
                proxy_pass http://mongrel_cluster/;
                  proxy_redirect     off;
                          }

       location ~
^/(images|javascripts|js|css|stylesheets|tiles|static|demo)/          {
            root /var/www/domain.in/app1/public;

            expires 30d;
        }

        location ~*
^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$
{
                  root /var/www/domain.in/app1/public;
                  expires 30d;
        }

        location / {
            proxy_pass  http://mongrel_cluster;
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
        }

        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html

         #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }



        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny  all;
        }
    }
}
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list