MacNN Forums (http://forums.macnn.com/)
-   Mac OS X (http://forums.macnn.com/mac-os-x/)
-   -   Can't get web server to work! (http://forums.macnn.com/90/mac-os-x/497712/cant-get-web-server-to-work/)

 
ibook_steve Jan 31, 2013 08:18 PM
Can't get web server to work!
It's annoying enough that Apple removed the web sharing GUI setting. But I can't get my local web server working at all, even after following a number of tutorials such as this one:

https://discussions.apple.com/docs/DOC-3083

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

# VIRTUAL HOST START
127.0.0.1 localhost
127.0.0.1 mysite.local
# VIRTUAL HOST STOP
 
besson3c Feb 4, 2013 04:48 PM
Quote, Originally Posted by ibook_steve (Post 4215523)
It's set to:

DocumentRoot "/Library/WebServer/Documents"

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.

But it's finally working!! Yay! Hope this helps others.

Steve
 
All times are GMT -4. The time now is 12:33 AM.

Copyright © 2005-2007 MacNN. All rights reserved.
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2016, vBulletin Solutions, Inc.


Content Relevant URLs by vBSEO 3.3.2