Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Apache - Where is the home site

I want to serve a website off my iMac (running Snow Leopard). I have a NOIP.com web redirect and my router is port forwarded to the iMac on Port 80. When I type in the url set up at NOIP I come to a website on my mac that simply says It Works! which I have found in /Library/Webserver/Documents which I understand is the DocumentRoot in Apache. I have replaced that html doc with my own. Same result. I have altered the DocRoot in the httpd.conf file - same result. What am I doing wrong that I cannot find the actual file being served by Apache.

iMac 27 inch i7, Mac OS X (10.6.2)

Posted on Mar 25, 2010 7:18 PM

Reply
13 replies

Mar 25, 2010 7:53 PM in response to Guy Edkins

There seems to be some conflation here between Mac OS X Server and Mac OS X client; I'm guessing you're running client here.

With Mac OS X client, you to manage the Apache pieces directly via the Apache configuration files.

Mac OS X Server is rather better set up for this stuff; it arrives with GUI tools to manage Apache.

As for the documentation root, the root is (as you mention) /Library/Webserver/Documents/ (both on client and on server) and you can create an x.html or such in that folder and (so long as it is read-accessible to the web server) you should be good to go. (Use +ls -al /Library/Webserver/Documents/+ to confirm the protections and ownership, and ensure that www (or _www) can read the file.)

The local folder is /Users/shortname/Sites/

As for the changes you are making to the configuration files, you may well have to un-do those.

For changes and for the HTML files, you'll want to be using vim or pico or nano or emacs or another text-oriented editor (a shell editor or equivalent), and not something that saves RTF or another format.

Mar 26, 2010 3:34 AM in response to MrHoffman

I am running client and perhaps I will look into OS X server on a Mini. I checked the permissions on the Document Root from Library on down and they all have read set to Everyone and R/W for sys and admin. I would assume that would work. I do know about the secondary user root folder but again do not know how to redirect the port 80 incoming request to answer using that directory via the httpd.conf file. I can undo the changes as I comments heavily. I use vi to edit so I don't believe it altered the extension and mucked things up further. Still at a loss, but thanks for the help. Not thrilled about having to get OS X server to solve this as on my previous iMac this worked fine but it started out in life as a plain old Leopard a machine and that had a different parameters in the httpd.conf and I got that to work just fine after a bit of a struggle - but not this odd one where the "It Works" file is no where to be found yet it loads each time I come in via the redirect from NOIP.com

Mar 26, 2010 7:45 AM in response to Guy Edkins

I'm presuming use of the command shell here; I don't know if you're using the GUI or bash. I'm launching Terminal.app and using the latter command interface here.

As a general suggestion, if you don't understand how something works (or how it doesn't work), then consider tweaking just one thing at a time, try it, and then (if it doesn't do what you need/want) set it back. I've been successful with this approach when I'm debugging, or when I'm exploring an operating system or an application. This is a fairly common baseline debugging technique, too. Ploughing forward and making and particularly accumulating various tests and changes en-mass leads nowhere other than confusion and often to reinstallation to reset the environment.

The "It works" file is /library/webserver/documents/index.html.en

Create a stub file, say, x.html, in that same directory, set the protections and ownership to match index.html.en (shell commands are chmod and chown here), and reference it from a browser running directly on the client. From a local browser, on the local client, and not with any of this NOIP stuff you're working with. Another tenet of debugging: eliminate pieces until you figure out what's going on. Here, baseline web services first. First. Not the NOIP stuff. That comes later. Ask for http://localhost/x.html, and see if you get your test file.

I've posted examples of chmod and chown [here|http://labs.hoffmanlabs.com/node/1329]; this article is centrally for Mac OS X Server, but the basic chmod and chown and ls commands are the same.

Once you have the local path and the local web server stuff working, then branch out and start looking at DNS and port-forwarding and related issues.

Mar 26, 2010 10:09 AM in response to MrHoffman

Yes I am using the shell (via terminal) I have granted root use and applied password to the root account. I do apply changes incrementally, no luck yet. I can easily back out to ground zero. I did not think to lok at the permissions of the fiels I put into the directories (new web files). I will check that against a stub file. I will try the local host stub file trick and see it I get to it. Its typical of OS changes. I get the hang of 10.4 Apache and then they change it for 10.5 and now again for 10.6. Problem is I can never remember what exactly I did and if you don't get it exact - it doesn't work! Thanks for the help.

Mar 26, 2010 7:30 PM in response to Guy Edkins

So you have placed a stub X.HTML into the directory containing something like ( Eh? or some such), and you have specified that X.HTML file when you accessed the web site remotely, and it did not work? Not a file named index.html or such. Create a file X.HTML off to the side. If this is with the integrated Apache (and not MAMP or such) I suspect you're getting tangled up with the Apache language support here with your attempts to get at the index.html file.

Mar 27, 2010 9:30 AM in response to MrHoffman

I did create a stub file and the browser just spins and never gets to the page I created when try to access from outside. If I do not specify the page I get It Works. The system is now in a default state as far as host files, httpd.conf, and the virtual hosts file. I cannot find the file the browser is finding from the outside. Very very odd.

Mar 28, 2010 10:11 AM in response to Guy Edkins

Is there evidence from within the Apache logs that the http request is arriving at the server? Check both the access and error logs. Test with both the default and with the test file. Confirm that the request is not being blocked by a firewall, by IP routing (dual-network controllers and routing, etc) and the network path leading into the server.

Mar 28, 2010 11:23 AM in response to MrHoffman

The plot thickens!

I checked the two logs (access and error) for entries for the 28th while I tried to access the website at both the default page (yields "It Works!") and my stub file(x.html) (never gets there) and neither added an entry to either log. These entries reveal errors back when the httpd.conf had been edited. It is now back to the as installed default. So if I never get to the page how is there no error!

Error log first

Here are the respective logs last entries:[Thu Mar 25 22:09:30 2010] [notice] Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8l DAV/2 configured -- resuming normal operations
[Thu Mar 25 22:09:45 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Thu Mar 25 22:09:46 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Thu Mar 25 22:09:47 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Thu Mar 25 22:11:24 2010] [error] [client 127.0.0.1] File does not exist: /Users/gedkins/Sites/guy
[Thu Mar 25 22:11:24 2010] [error] [client 127.0.0.1] File does not exist: /Users/gedkins/Sites/guy, referer: http://randomlight/
[Fri Mar 26 20:08:42 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:08:43 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:08:44 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:13:45 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:13:46 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:13:46 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:28:36 2010] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://127.0.0.1/
[Fri Mar 26 20:32:24 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:32:28 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:32:29 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/
[Fri Mar 26 20:32:29 2010] [error] [client 173.76.157.188] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: http://stoneway.servehttp.com/

Access log

173.76.157.188 - - [26/Mar/2010:20:08:42 -0400] "GET /favicon.ico HTTP/1.1" 404 209
173.76.157.188 - - [26/Mar/2010:20:08:43 -0400] "GET /favicon.ico HTTP/1.1" 404 209
173.76.157.188 - - [26/Mar/2010:20:08:44 -0400] "GET /favicon.ico HTTP/1.1" 404 209
173.76.157.188 - - [26/Mar/2010:20:13:45 -0400] "GET /favicon.ico HTTP/1.1" 404 209
173.76.157.188 - - [26/Mar/2010:20:13:46 -0400] "GET /favicon.ico HTTP/1.1" 404 209
173.76.157.188 - - [26/Mar/2010:20:13:46 -0400] "GET /favicon.ico HTTP/1.1" 404 209
127.0.0.1 - - [26/Mar/2010:20:28:36 -0400] "GET / HTTP/1.1" 200 314
127.0.0.1 - - [26/Mar/2010:20:28:36 -0400] "GET /favicon.ico HTTP/1.1" 404 209
127.0.0.1 - - [26/Mar/2010:20:28:36 -0400] "GET /Site/Welcome.html HTTP/1.1" 200 11223
127.0.0.1 - - [26/Mar/2010:20:28:36 -0400] "GET /Site/Scripts/iWebSite.js HTTP/1.1" 200 146115
127.0.0.1 - - [26/Mar/2010:20:28:36 -0400] "GET /Site/Scripts/Widgets/SharedResources/WidgetCommon.js HTTP/1.1" 200 36124
127.0.0.1 - - [26/Mar/2010:20:28:36 -0400] "GET /Site/Scripts/Widgets/Navbar/navbar.js HTTP/1.1" 200 5986
127.0.0.1 - - [26/Mar/2010:20:28:37 -0400] "GET /Site/Welcome_files/Welcome.js HTTP/1.1" 200 2344
127.0.0.1 - - [26/Mar/2010:20:28:37 -0400] "GET /Site/Welcome_files/Welcome.css HTTP/1.1" 200 4628
127.0.0.1 - - [26/Mar/2010:20:28:38 -0400] "GET /Site/Scripts/iWebImage.js HTTP/1.1" 200 39662

Mar 28, 2010 11:44 AM in response to Guy Edkins

this has nothing to do with apple and all to do with apache config.

if you drop your static example page in /Library/WebServer/Documents and ensure proper permissions to the file(s), restart apache, and it should "just work."

name your test file index.html and/or move aside the default index file if you want to avoid seeing it.

Mar 28, 2010 11:57 AM in response to foilpan

Thats the rub! In the root docs dir is an index.html file that if I open it directly is my website (test) and yet from the outside I get the It Works page which is neither in the local /users/gedkins/sites location or in the /Library/WebServer/Documents location so it appears apache is pointing somewhere else however the Document Root is defined as follows

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"

It is very strange to me.

Mar 28, 2010 6:39 PM in response to foilpan

Oddly enough it seems to have suddenly decided to start working. Not really sure why. I did play with port forwarding in the router but did not actually change the settings. I simply bounced the router it seems to have cured the problem. I think there is some caching issues in the browser too. But thanks to all who helped. In the end it was a lot of work that actually was none at all. In essence all I did was turn on web services and it should have worked. It didn't appear to so I altered settings that in the httpd.conf needlessly.

Apache - Where is the home site

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.