Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Old 02-27-2012, 10:42 AM   #1
laredotornado
Prospect
 
Join Date: Apr 2010
Posts: 37
Where are default Apache docs served from?

Hi,

I'm using Mac OSX Lion and wondering how to get my default installation of Apache working. I started the web server fine from a terminal using

Code:
davea$ sudo apachectl start
However, I consistently get 404s when trying to visit http://localhost/, even though I have an index.html file located in /Library/WebServer/Documents . In my /private/etc/apache2/httpd.conf file, I have

Code:
<IfDefine !MACOSXSERVER>
<IfDefine WEBSHARING_ON>
#
# 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"
How do I check/set the values of "MACOSXSERVER" and "WEBSHARING_ON"? Thanks, - Dave
laredotornado is offline   Reply With Quote
Old 02-28-2012, 12:45 AM   #2
ganbustein
MVP
 
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,167
Your documents need to be readable by Apache. The easiest way to do that is make them world-readable (i.e., "everyone" can read). Apache actually runs the browser as user _www (userid 70). Folders and any cgis also need to be world-executable (or at least executable by _www).
ganbustein is offline   Reply With Quote
Old 02-28-2012, 01:26 AM   #3
acme.mail.order
League Commissioner
 
Join Date: Sep 2003
Location: Tokyo
Posts: 6,328
Unreadable documents produce a 403 Forbidden error, not a 404 Not Found error.

You have not achieved Kolinahr. Your answer lies elsewhere.
acme.mail.order is online now   Reply With Quote
Old 02-28-2012, 04:07 AM   #4
agentx
Hall of Famer
 
Join Date: Feb 2003
Location: Brighton, UK
Posts: 4,115
System Preferences > Sharing > Turn on Websharing

You can serve up pages by either "creating a personal website folder" in your home folder or from /Library/WebServer/Documents once enabled.

Now it is more than likely a permissions issue on files in /Library/WebServer/Documents
agentx is offline   Reply With Quote
Old 02-28-2012, 04:40 AM   #5
acme.mail.order
League Commissioner
 
Join Date: Sep 2003
Location: Tokyo
Posts: 6,328
Quote:
Originally Posted by laredotornado
Code:
davea$ sudo apachectl start

Quote:
Originally Posted by agentx
System Preferences > Sharing > Turn on Websharing

More or less the same thing.


laredotornado: what else have you done to the default installation?
acme.mail.order is online now   Reply With Quote
Old 02-28-2012, 05:33 AM   #6
agentx
Hall of Famer
 
Join Date: Feb 2003
Location: Brighton, UK
Posts: 4,115
I agree it is the same but it will list the connection address's in the GUI and allow you to create a personal web sharing folder which is worth testing instead of root webserver folder.

from memory you also may need to set your index file to be index.html on OS X unless you add an Apache directive.
I personally always have used MAMP for devs as it works better and provides an easy way to setup MySQL, PHP, virtual hosts etc.

Last edited by agentx; 02-28-2012 at 05:36 AM.
agentx is offline   Reply With Quote
Old 02-28-2012, 09:33 PM   #7
ambrose
Triple-A Player
 
Join Date: Feb 2003
Location: Western New England
Posts: 73
Consider reviewing the contents of /private/var/log/apache2/error_log
ambrose is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:28 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.