I am learning Ruby on rails from a PDF on ruby.railstutorial.org. I have been learning for about a week and a half now and have not had any trouble until yesterday. I was building a sample app and tried to look at some results in the browser but for some reason it says 'safari can't open page "localhost:3000/static_pages/home" because Safari cannot connect to the server "localhost".
Try http://0.0.0.0:3000
. That works for me. Not sure why Safari doesn't like localhost.
Try 127.0.0.1
, enable web sharing in System Preferences, and if running, turn off Apache.
Is your Rails server running? If not, launch it with rails s
from the sample_app folder in Terminal. Alternatively, if it is running, quit it with ctrl+c
and then start it again with the first command.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.