The Rails application is running on port 3000:
$ bundle exec rails server -b 0.0.0.0
=> Booting Unicorn
=> Rails 3.2.21 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
(eval):1: warning: encountered \r in middle of line, treated as a mere space
listening on addr=0.0.0.0:3000 fd=14
worker=0 spawning...
master process ready
worker=0 spawned pid=5811
worker=0 ready
Website is available on the Virtual Machine:
$ wget 127.0.0.1:3000
--2016-05-05 05:15:54-- http://127.0.0.1:3000/
Connecting to 127.0.0.1:3000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.html'
[ <=> ] 42,036 --.-K/s in 0s
2016-05-05 05:15:55 (222 MB/s) - `index.html' saved [42036]
But from the host machine:
$ wget http://127.0.0.1:3000/
--2016-05-05 00:07:02-- http://127.0.0.1:3000/
Connecting to 127.0.0.1:3000... failed: Connection refused.
Port Scanning host: 127.0.0.1:
Open TCP Port: 21 ftp
Open TCP Port: 22 ssh
Open TCP Port: 80 http
Open TCP Port: 88 kerberos
Open TCP Port: 111 sunrpc
Open TCP Port: 445 microsoft-ds
Open TCP Port: 548 afpovertcp
Open TCP Port: 631 ipp
Open TCP Port: 965
Open TCP Port: 975
Open TCP Port: 1015
Open TCP Port: 1019
Open TCP Port: 2049 nfsd
Open TCP Port: 2200 ici
Open TCP Port: 2222 rockwell-csp2
Open TCP Port: 3300
Open TCP Port: 5432 postgresql
Open TCP Port: 8080 http-alt
This is the basic contents of /private/etc/hosts
:
127.0.0.1 localhost
127.0.0.1 test.localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
192.168.33.102 vagrant # VAGRANT: c460068dd8a5a09607cfd3402843d82a (local) / 0668df93-b211-421f-86db-bb2ff8e57175
192.168.44.44 vdd.dev # VAGRANT: 07e9613958e0db441d6b9af1328fa214 (default) / 4d655cd6-bf5a-442a-8093-4ac431b7d890
The nginx/error.log
is just confirming the refused connection and Unicorn log equally uninformative as far as I can tell.
This is contents of /etc/nginx/sites-available/my_application
:
upstream unicorn {
server unix:/home/vagrant/apps/ofn_america/shared/sock/unicorn.ofn_america.sock fail_timeout=1;
}
server {
listen 80;
server_name 127.0.0.1;
rewrite ^/(.*) http://127.0.0.1/$1 permanent;
}
server {
listen 80;
server_name 127.0.0.1;
root /home/vagrant/apps/ofn_america/current/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 $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://unicorn;
}
location ~ ^/(assets)/ {
gzip_static on;
expires max;
add_header Cache-Control public;
#add_header Last-Modified "";
#add_header ETag "";
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 60;
}
Any suggestions?
I'm not sure where else to poke around.
127.0.0.1
always refers to the local machine, so in the VM its referring to the VM, but on the host, its referring to the host machine.