upstream waimai { server unix:///mnt/www/relation_api/shared/tmp/sockets/puma.sock; } # http server { listen 80; server_name api.itrydo.com api.waimai.com adm.waimai.com bus.waimai.com; # change to match your URL index index.html; root /mnt/www/relation_api/current/public; # I assume your app is located at that location try_files $uri/index.html $uri @app; location @app { # try_files $uri/index.html $uri =404; proxy_pass http://waimai; # match the name of upstream directive which is defined above proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /cable { proxy_pass http://waimai; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } }