hibiken / stories

Medium clone built with Ruby on Rails
https://my-medium-clone.herokuapp.com/
MIT License
826 stars 270 forks source link

Install Issue: Rails on localhost #29

Closed milezzz closed 8 years ago

milezzz commented 8 years ago

Very good instructions to get this going but I am a Rails n00b, so I hope someone can help. Everything went well but I have one annoying issue. RoR bound to localhost rather than 127.0.0.1. I am not sure why. When I try a curl from the local command line I can see stories running on http://localhost:3000 but not on http://127.0.0.1:3000

Anybody else run into this?

No work:

$ curl -I http://127.0.0.1:3000 HTTP/1.1 403 Forbidden Server: nginx/1.8.1

Works:

$ curl -I http://localhost:3000 HTTP/1.1 200 OK X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff Content-Type: text/html; charset=utf-8 Cache-Control: no-store, must-revalidate, private, max-age=0 Set-Cookie: request_method=HEAD; path=/ Set-Cookie: _stories_session=YURHN1FDaG41ZFo1bk1sWkpWNEtTQVp0VVVEMGVkVnhqMklETDR5MnBiZjBHLzkyek1wQ1ZGc0RhcXJQak00UnB5eEVoSzVwSStJelJFTnFpNGxZbWw3WGZhSmxhOUtBMkJyYTN1NzYya1pvS1pldHNZNi9qajloa1J1WDNtYjVIelVXdk0rNm1JM1phc3hUOFVHRHVBPT0tLXZuR0RVZzhUaUh0SkV2Mlo5dW90eFE9PQ%3D%3D--10f8b331fe6ded5d0f90f4ae314f7261bff62468; path=/; HttpOnly

milezzz commented 8 years ago

Solved this by commenting a line in /etc/hosts:

#::1 localhost ip6-localhost ip6-loopback

Now my problem remains is how to reverse proxy port 3000 to 80 with nginx. Possible for someone to share their nginx vhost config please?

milezzz commented 8 years ago

Fixed. I'll contribute my nginx config when I get a minute.

Software looks great, so glad this project is so far along. I think it's really important stuff. Well done Kenny!

hibiken commented 8 years ago

Thanks!! Looking forward to the PR!!