|
|
Can't get web server to work!
|
|
|
|
Moderator
Join Date: Oct 2001
Location: San Jose, CA
Status:
Offline
|
|
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
|
Celebrating 10 years and 4000 posts on MacNN!
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
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?
|
|
|
|
|
|
|
|
|
Moderator
Join Date: Oct 2001
Location: San Jose, CA
Status:
Offline
|
|
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
|
Celebrating 10 years and 4000 posts on MacNN!
|
|
|
|
|
|
|
|
Posting Junkie
Join Date: Mar 2004
Location: UK
Status:
Offline
|
|
What does the apache config file say is the root folder for site documents?
|
I have plenty of more important things to do, if only I could bring myself to do them....
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
|
Moderator
Join Date: Oct 2001
Location: San Jose, CA
Status:
Offline
|
|
Originally Posted by Waragainstsleep
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
|
Celebrating 10 years and 4000 posts on MacNN!
|
|
|
|
|
|
|
|
Moderator
Join Date: Oct 2001
Location: San Jose, CA
Status:
Offline
|
|
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
|
Celebrating 10 years and 4000 posts on MacNN!
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
Originally Posted by ibook_steve
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?
|
|
|
|
|
|
|
|
|
Moderator
Join Date: Oct 2001
Location: San Jose, CA
Status:
Offline
|
|
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
|
Celebrating 10 years and 4000 posts on MacNN!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|