I can't even see the "It works!" page in /Library/WebServer/Documents.

I've tried messing with permissions but it just doesn't work, and I want to test pages I'm creating. Any ideas or things I should try or check?

Thanks,
Steve

besson3c

Feb 1, 2013 04:01 AM

1) Are you seeing any error messages when you sudo apachectl restart ?
2) Are you seeing any error messages being logged to your log files?

ibook_steve

Feb 1, 2013 06:10 PM

No errors when I restart the server, but my logs show for servers called "dummy-host.example.com". Now I noticed that listed in the Web sharing preference pane you can install following those tutorials (Web Sharing in OS X Mountain Lion) as "Local web sites" but I couldn't change it.

In the error_log, I get errors that "/usr/docs/dummy-host.example.com does not exist".

Could this be part of my problem?

I also get errors: client denied by server configuration: /usr/docs

But there is no /usr/docs directory.

Steve

Waragainstsleep

Feb 2, 2013 03:43 PM

What does the apache config file say is the root folder for site documents?

besson3c

Feb 2, 2013 04:33 PM

If you are wanting to serve files out of the Sites folder in your home directory you'll need to enable the userdir module, and make sure your URL parts start with "~username/" Otherwise, you'll need to make sure that the document root specified by Apache exists (which seems like it is /usr/docs/dummy-host.example.com), and that your web files you wish to access reside there. If you are wanting to access multiple sites you will need to setup virtualhosts.

Also make sure that if you are using the domain "dummy-host.example.com" that this domain resolves to your local IP. One easy way to do that is to setup an entry in /etc/hosts to point to 127.0.0.1.

ibook_steve

Feb 4, 2013 02:27 PM

Quote, Originally Posted by Waragainstsleep
(Post 4215228)

What does the apache config file say is the root folder for site documents?

It's set to:

DocumentRoot "/Library/WebServer/Documents"

though I tried changing it to my Sites folder and that didn't work either.

Steve

ibook_steve

Feb 4, 2013 02:32 PM

Here's my hosts file. Maybe I screwed this up somehow. Why is this so complicated?:

##
# 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

though I tried changing it to my Sites folder and that didn't work either.

Steve

Can you be more specific about what isn't working? Is the Apache process running? What URL are you using to access your site? What are you seeing in your logs when you try to access your site? When you restart your web server what are you seeing in your logs?

Have you thought about installing your own Apache version via Homebrew or Macports?

ibook_steve

Feb 4, 2013 05:58 PM

OK, I finally got it working!

I gave up on my httpd.conf file. I replaced it with the one in the "original" directory. That got my localhost "It works!" site working from /Library/Webserver/Documents. I have no idea what was wrong with my httpd.conf file, unless it had something to do with the upgrade from Lion to Mountain Lion last year (which from some Googling could be the case).

Then, the only problem I had was a permissions problem according to the error log, but I didn't know where since I had set my Sites directory to 777. But I learned from here ((13)Permission denied | Dreaming Of Beetles) that you have to have 755 permissions all the way down, not just on my Sites folder. Well going up the directory chain, my user folder (/Users/<my short name>) had permissions set to 750 for some reason. When I changed this to 755, boom!

I kept commented out the use of virtual hosts in httpd.conf since I don't need to run multiple sites, just the one that I'm testing.