ruby on rails - Nginx and Unicorn Basic Config -


i got vm had nginx, unicorn , fresh rails app installed. looked @ nginx config file, , not understand how connects unicorn, since there doesn't seem upstream setting (which tutorial's need).

here config settings:

/home/unicorn/unicorn.conf

listen "127.0.0.1:8080" worker_processes 2 user "rails" working_directory "/home/rails" pid "/home/unicorn/pids/unicorn.pid" stderr_path "/home/unicorn/log/unicorn.log" stdout_path "/home/unicorn/log/unicorn.log" 

/etc/nginx/sites-enabled/default - default file within sites-enabled directory

server {         listen   80;         root /home/rails/public;         server_name _;         index index.htm index.html;          location / {                 try_files $uri/index.html $uri.html $uri @app;         }          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|mp3|flv|mpeg|avi)$ {                         try_files $uri @app;                 }           location @app {                 proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;                 proxy_set_header host $http_host;                 proxy_redirect off;                 proxy_pass http://app_server;     }  } 

the server seems defining location @app, , passing requests http://app_server ... not sure obtain app_server ... upstream defined elsewhere?

fore more info, article has exact same set vps. https://www.digitalocean.com/community/articles/how-to-1-click-install-ruby-on-rails-on-ubuntu-12-10-with-digitalocean

normally app_server defined in file upstream. example - on debian system have location set similar yours pointing upstream called www

in /etc/nginx/sites-enabled directory have file called upstream_www_app following content

upstream www {   server localhost:24910 fail_timeout=0 weight=5; } 

24910 port defined in applications config/unicorn.rb , main nginx.conf includes files in sites-enabled directory.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -