ruby on rails - Serving various sites inside one VPS with nginx -
i followed tutorial in rails casts: #335 deploying vps. have linode vps set ubuntu 10.04 image , can deploy it. it's serving:
/home/user0/first-rails-app/public (domain1.com) i want use nginx serve rails app , php app, asume stored here:
/home/user1/php-app/public (domain2.com) /home/user2/another-rails-app/public (subdomain.domain1.com) my nginx.conf
upstream unicorn { server unix:/tmp/unicorn.blog.sock fail_timeout=0; } server { listen 80 default deferred; # server_name example.com; root /home/user0/first-rails-app/public; location ^~ /assets/ { gzip_static on; expires max; add_header cache-control public; } try_files $uri/index.html $uri @unicorn; location @unicorn { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_redirect off; proxy_pass http://unicorn; } error_page 500 502 503 504 /500.html; client_max_body_size 4g; keepalive_timeout 10; } all domains , sub domain point server (x.x.x.x). i'm not sure how use unicorn 2 rails apps in same server, if virtual hosts correctly setup in nginx.conf.
any suggestions start looking or modify?
thanks!
you have declare multiple upstreams in conf
upstream app1 { server unix:/tmp/app1.sock; } upstream app2 { server unix:/tmp/app2.sock; } server { server_name http://www.example.com location /foo {proxy_pass http://app1; break;} location /bar {proxy_pass http://app2; break;} }
Comments
Post a Comment