Nginx, unicorn and multiple rails apps in subrirectories -
i'm messing around aws, , want deploy multiple apps free tier aws account.
i'd have nginx point "ec-2-site.com/first-app" , "ec-2-site.com/second-app.
here current config files (basically guess , checking this railscast
upstream unicorn_chaos { server unix:/tmp/unicorn.chaos.sock fail_timeout=0; } upstream unicorn_blog { server unix:/tmp/unicorn.blog.sock fail_timeout=0; } server { listen 80 default deferred; location /chaos/ { #server_name http://ec2-50-16-81-170.compute-1.amazonaws.com/chaos; root /home/deployer/apps/chaos/current/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_chaos; } error_page 500 502 503 504 /500.html; client_max_body_size 4g; keepalive_timeout 10; } location /blog/ { # server_name example.com; root /home/deployer/apps/blog/current/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)blog; } error_page 500 502 503 504 /500.html; client_max_body_size 4g; keepalive_timeout 10; } }
here error i'm getting:
nginx: [emerg] named location "@unicorn_chaos" can on server level in /etc/nginx/sites-enabled/chaos:23
obviously @unicorn_appname directive shouldn't there, should be? going bout wrong?
thanks
i didn't check railscast i've found problems in configuration.
first on line 50 misspelled address.
second should put named locations out of locations.
your hierarchy looks this
server location app1 try_files @unicorn location @unicorn proxy_pass unicorn_app1 location app2 try_files @unicorn location @unicorn proxy_pass unicorn_app2
try this
server location app1 try_files unicorn_app1 location @unicorn_app1 proxy_pass unicorn_app1 location app2 try_files @unicorn_app2 location @unicorn_app2 proxy_pass unicorn_app2
the important keep names unique, , put them in same server level.
Comments
Post a Comment