PDA

View Full Version : Apache is not working, pls help!!




c98928
Jun 27, 2009, 02:31 PM
All of sudden my Apache just stopped working.

I have checked that Web Sharing is on, but all I got is:
Firefox can't establish a connection to the server at 10.0.1.2.

Then I tried to restore httpd.conf file to its original version, which obviously had little help.

Later I tried to run apachectl -t to see anything wrong with the status, then I got this message:
Syntax error on line 164 of /private/etc/apache2/httpd.conf:
DocumentRoot must be a directory
The actual of this line 164 reads:
DocumentRoot "/Library/WebServer/Documents"
but apparently this directory does exist.

I also have another clue from /var/log/apache2/error_log:
[Fri Jun 26 16:21:55 2009] [error] [client 10.0.1.4] client denied by server configuration: /Library/WebServer/Documents
[Fri Jun 26 16:22:03 2009] [error] [client 10.0.1.4] client denied by server configuration: /Library/WebServer/Documents
[Fri Jun 26 16:22:13 2009] [error] [client 10.0.1.4] client denied by server configuration: /Library/WebServer/Documents, referer: http://10.0.1.4/
[Fri Jun 26 16:22:24 2009] [error] [client 10.0.1.4] client denied by server configuration: /Library/WebServer/Documents
[Fri Jun 26 16:22:54 2009] [error] [client 10.0.1.4] File does not exist: /Users/yaochen/Sites/test.html
[Fri Jun 26 16:22:57 2009] [error] [client 10.0.1.4] File does not exist: /Users/yaochen/Sites/test.html
[Sat Jun 27 03:40:07 2009] [warn] child process 413 still did not exit, sending a SIGTERM
[Sat Jun 27 03:40:07 2009] [warn] child process 446 still did not exit, sending a SIGTERM
[Sat Jun 27 03:40:07 2009] [warn] child process 452 still did not exit, sending a SIGTERM
[Sat Jun 27 03:40:07 2009] [warn] child process 455 still did not exit, sending a SIGTERM
[Sat Jun 27 03:40:07 2009] [warn] child process 456 still did not exit, sending a SIGTERM
[Sat Jun 27 03:40:08 2009] [notice] caught SIGTERM, shutting down

This has been driving me crazy, please, please help me!!!



angelwatt
Jun 27, 2009, 03:04 PM
Sounds like the permissions got messed up for /Library/WebServer/Documents.

Guiyon
Jun 27, 2009, 03:21 PM
OP, mind positing the output from the below command?

stat -x "/Library/WebServer/Documents"

angelwatt
Jun 27, 2009, 04:03 PM
I should note I don't use the built-in server. I use MAMP, but I have tinkered with the built-in one.
:~> stat -x /Library/WebServer/Documents/
File: "/Library/WebServer/Documents/"
Size: 1224 FileType: Directory
Mode: (0775/drwxrwxr-x) Uid: ( 0/ root) Gid: ( 80/ admin)
Device: 14,2 Inode: 33259 Links: 36
Access: Sat Jun 27 07:07:06 2009
Modify: Thu May 14 20:35:44 2009
Change: Thu May 14 20:35:44 2009

c98928
Jun 27, 2009, 11:45 PM
OP, mind positing the output from the below command?

stat -x "/Library/WebServer/Documents"

Thanks for the reply, the directory pretty much does not exist:
$ stat -x "/Library/WebServer/Documents"
stat: /Library/WebServer/Documents: stat: No such file or directory

I tried earlier to make a symbolic link Documents pointing to ~/Sites but it didn't help.

What I feel weird is that I have almost done nothing since last time it worked, except for that updating Airport Express Firmware and Vmware Fusion, both which I don't think they have explicit link to this problem.

angelwatt
Jun 28, 2009, 07:42 AM
Thanks for the reply, the directory pretty much does not exist:

Make sure to create that folder then (if you haven't already). That should help it process the httpd.conf file, then you can see if your Sites folder works properly.

c98928
Jul 2, 2009, 08:24 AM
Thanks everyone for you replies,

I have solve the problem by simply changing the value of DocumentRoot to /Users/myusername/Sites.

Still not sure why it stopped working in the first place. Maybe this could help somebody else who have a similar problem.