Cannot access localhost after upgrade to Mavericks but can access 127.0.0.1 I ran across this question, but it wasn't resolved (and it hasn't been touched in a while). I'm not sure if my issue is the same, but I don't have enough reputation here to comment on that question.

I just upgraded from Snow Leopard (10.6.8) to Mavericks. Before the upgrade, I was able to visit http://localhost; but now I can't. I checked my hosts file, and it looked ok (but this isn't quite my area of expertise):

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost


I am still able to visit 127.0.0.1. This wouldn't necessarily be a huge deal, but I'm trying to use Sinatra on Thin which isn't working after the OS upgrade either (it was working on my Snow Leopard setup), so I fear there may be an underlying issue that could have other negative effects. Thanks.
Everything seems to be working now. I can access localhost again, and my app is running Sinatra on Thin as it was before. Thanks to bmike, I did a bit of searching on why my loopback was unreachable and came across this article. I moved my old hosts file (/etc/hosts) to hosts.old and made a new one in its place that simply contained:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1           localhost
255.255.255.255     broadcasthost
::1                 localhost
fe80::1%lo0         localhost


Then, I ran dscacheutil -flushcache and rebooted my computer*. After that, things appear to be working normally again. I can only guess that something weird happened with my old hosts file. I also took JakeGould's advice and blew away ruby 2.0.0 (I still had ruby 1.8.7--you cannot uninstall ruby entirely on a mac, since it uses ruby for other things) and rvm and reinstalled those; but I'm not sure that had anything to do with my success, as I still had the same issues until I followed the steps outlined above.

Note: the above hosts file contains virtually the same thing that I say my hosts file contained before (see original question); however, there were other things in my original hosts file that I did not share in my question (I just shared what I thought was the relevant part), so perhaps something there got borked when I upgraded--I wish I knew for sure.

*Rebooting is probably not necessary. I actually had this problem after setting up a new user from a backup drive on my machine at work (which is running Mountain Lion) and (just today) followed the same steps above (minus blowing away ruby and rebooting the machine), and it worked. This leads me to believe that the heart of the issue was a borked /etc/hosts file.