Thanks, Anand.Here's my sites-enabled file (with filename mashweb), which directs requests to my mashwebclub app properly. I tried adding another server block but couldn't get it to point to the other Rails app. Previously the same file except with the difference that server_name was mashweb.club also worked. My other domain, zwm.org.in, gets directed to the 'Welcome to Nginx!' page. (I was really surprised by that, since server_name is now _.) Each Rails app has its own root, socket, and domain name. Both domain names point to the droplet's IP address.upstream mashwebclub_app {# Path to Unicorn SOCK file, as defined previouslyserver unix:/home/rails/mashwebclub/shared/sockets/unicorn.sock fail_timeout=0;}server {listen 80;server_name _;try_files $uri/index.html $uri @mashwebclub_app;root /home/rails/mashwebclub/public;location @mashwebclub_app {proxy_pass http://mashwebclub_app;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header Host $http_host;proxy_redirect off;}error_page 500 502 503 504 /500.html;client_max_body_size 4G;keepalive_timeout 10;}TomMobile: +91 9845222813On Fri, Apr 14, 2017 at 1:12 PM, Anand Chitipothu <anand...@gmail.com> wrote:AnandHi Tom,I run lot of webapps on my digital ocean. I don't have experience with rails, but if you can share an example of working configuration, I'll be able to help you with the rest.
--
You received this message because you are subscribed to the Google Groups "BANGALORE RUG-Ruby Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bangalorerug+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I'm using the Rails One-Click App', which has Ubuntu 16.04. A fuller description is at https://goo.gl/4tFuUO . I ripped out rvm and replaced it with rbenv. I tried one config file per domain, but maybe I messed it up. I don't suppose you're familiar with unicorn, but it's correctly listening on a socket in the one-app case.Here's the output of tree:root@ruby-rails-512mb-blr1-02:~# tree /etc/nginx/etc/nginx├── conf.d├── fastcgi.conf├── fastcgi_params├── koi-utf├── koi-win├── mime.types├── nginx.conf├── nginx.conf.orig├── proxy_params├── scgi_params├── sites-available│ ├── default│ ├── default.orig│ ├── mashwebclub│ ├── mashwebclub.1domain-ok│ ├── mashwebclub.2domains│ ├── mashwebclub.mashwebclub│ ├── mashwebclub.no│ ├── rails│ ├── rails.orig│ └── zwm├── sites-enabled│ └── mashwebclub -> ../sites-available/mashwebclub├── snippets│ ├── fastcgi-php.conf│ └── snakeoil.conf├── uwsgi_params└── win-utf4 directories, 24 files
--
Yeah, I tried that. I really don't understand the basics. When are two server blocks in one config file appropriate? When are two config files appropriate?
Sounds like I need to try the second config file again.
One more question (actually, a few), though. Have you got any idea why mashweb.club comes up when I browse http://139.59.29.244 ? It seems arbitrary. Why not zwm.org.in at least sometimes? Is there a priority? Does it have to do with which service starts first? Can I set a basic Nginx page if the domain name is not given?
WHOOPIE! I got two Rails apps working on the same $5/month DigitalOcean droplet, using the same IP address but with different domain names! You can see this for yourself (if you want) by running WHOIS on mashweb.club and zwm.org.in. (Well, you'll see they're on the same IP address and that they both use DigitalOcean's name servers.)There was a lot in my second app that wasn't set up, but I noticed this when I got the courage to try your suggestion.Your service to me as an Nginx scout has been invaluable!Thanks a lot, Anand. If I can ever help you with Rails, JavaScdript, Lisp, or Scheme, let me know.