Why is "It works!" showing up at my http://127.0.0.1 (localhost)?

21

4

So, I was playing around with Java sockets, servers and streams, the other day, and I decided, purely out of curiosity, expecting no good results, to open Google Chrome and navigate to 127.0.0.1, and lo and behold, I come across an actual page! The page source is <html><body><h1>It works!</h1></body></html>

I got hit with an epiphany that I could easily start playing around with HTML and possibly create my own website if I could find what was causing this page to come up, and where on my computer the page is located. I was searching for a possible installation that I might have made that would make my iMac (and Macbook; this thing happened on the iMac AND Macbook) act this way. So far, I've come up with the possibility of it being Eclipse EE, XCode, BBEdit, MonoDevelop (unlikely), LabView (also unlikely) or a few other programs. Those are the only developer programs I have installed that might have this effect. I don't have Apache.

Any help would be greatly appreciated.

Carter Pape

Posted 2011-10-03T20:12:01.087

Reputation: 373

Answers

32

This is default behavior in OSX when you enable the web server in the properties. You can find it in this control pane: enter image description here

Bart De Vos

Posted 2011-10-03T20:12:01.087

Reputation: 988

1Hey that's it! Thanks for the answer, I forgot I left that on. I just turned it off because I had forgotten to a while back when I was playing with settings. – None – 2011-10-03T20:34:34.077

11

Newer versions of macOS might not have the option displayed in the Sharing panel, as is shown in Bart De Vos's answer. In that case, running this command from Terminal should stop it:

sudo apachectl stop

Based on my own experience, it shouldn't start up automatically after that, even after a system restart.

Or, if you want to start it manually:

sudo apachectl start

Chris

Posted 2011-10-03T20:12:01.087

Reputation: 273

3Thanks, took way to log to figure that out for me. I had to google the exact HTML it was returning to find this comment. Also, interestingly running lsof -i :80 didn't show anything running on port 80 which threw me for a while. doing the stop command on apache fixed the issue. – Foovanadil – 2017-05-18T17:27:45.670

1Actually to update that comment about lsof. It will show something but you need to SUDO the command to see things on port 80. If you don't it doesn't fail it just looks like nothing is running on that port. – Foovanadil – 2017-05-18T17:30:08.380