PDA

View Full Version : Apache2 (WebSharing) Failed To Connect


cmdshft
02-05-2009, 06:42 AM
All of a sudden, my Apache 2 cannot be connected to. It is enabled in system preferences, and I've made no changes other than the necessary ones (enable PHP and change access port).

I thought the problem was after installing Darwin Streaming Server, so I uninstalled everything according to a guide I followed, but even now it's still not working.

I checked /etc/hostconfig, and it says WEBSERVER=-NO-, which is what it's supposed to be after having a friend test it on his system.

Any way to fix this or reinstall the websharing?

I mounted the DVD I used to install, and opened it up with Pacifist. I dug down to the apache2 part and installed that again. Rebooted, no joy.

This sucks, because I used my apache all the time for things. Everything else works though, FTP, SSH, everything.

throttlemeister
02-05-2009, 07:40 AM
Is it actually running? (ps -ef|grep apache)

If so, is it listening to the port you expect? (netstat -a|grep http for default port 80)

What are the logs saying (typically located in /var/log/Apache/)? Any errors?

cmdshft
02-05-2009, 08:01 AM
[harataiki@Shadow-of-Intent ~]# ps -ef | grep apache
501 531 517 0 0:00.00 ttys000 0:00.00 grep apache
[harataiki@Shadow-of-Intent ~]# netstat -a | grep 80
tcp4 0 0 192.168.1.112.49180 kc-in-f125.googl.jabbe ESTABLISHED
56b1880 stream 0 0 6831cf0 0 0 0 /tmp/icssuis501
5527908 stream 0 0 622d480 0 0 0 /tmp/launch-J5bXBX/Listeners
5527880 stream 0 0 0 0 0 0
4fcc880 stream 0 0 0 4fcc990 0 0
4fcc990 stream 0 0 0 4fcc880 0 0
5710880 dgram 0 0 0 5710908 5710908 0
5710908 dgram 0 0 0 5710880 5710880 0
56cf660 dgram 0 0 0 4fccdd0 0 56cf880
56cf880 dgram 0 0 0 4fccdd0 0 5527990

2/5/09 1:53:47 AM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 10 seconds
2/5/09 1:53:47 AM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 10 seconds
2/5/09 1:53:57 AM org.apache.httpd[662] (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log.
2/5/09 1:53:57 AM org.apache.httpd[662] Unable to open logs
2/5/09 1:53:57 AM com.apple.launchd[1] (org.apache.httpd[662]) Exited with exit code: 1

Here is my httpd.conf file (in a text file): Download (http://hara.ipwn.me/other/files/other/mac/osx86/confs/httpd.txt)

throttlemeister
02-05-2009, 08:41 AM
Your Apache is not running, so it is not surprising you cannot connect. :)

According to your logs, there is a problem with your logfiles and/or log directory.

Check if your log directory /private/var/log/apache2 excists, and if there is a error_log and access_log.

If there are, probably the permissions are incorrect. Most likely, the directory and/or logfiles are owned by root, and the Apache server is starting under user www. If the directory ownership is not www (ls -la to check), then do a "chown -R www:www /private/var/log/apache2" and try to start apache again.

HTH

cmdshft
02-05-2009, 08:48 AM
I don't see the dir:

[harataiki@Shadow-of-Intent ~]# ls /private/var/log/
alf.log install.log.1.bz2 system.log.0.bz2
asl monthly.out system.log.1.bz2
cups secure.log system.log.2.bz2
daily.out secure.log.0.bz2 system.log.3.bz2
fsck_hfs.log secure.log.1 system.log.4.bz2
ftp.log secure.log.2.bz2 system.log.5.bz2
hdiejectd.log secure.log.3.bz2 weekly.out
install.log secure.log.4.bz2 windowserver.log
install.log.0.bz2 system.log windowserver_last.log
[harataiki@Shadow-of-Intent ~]# ls /private/var/log/apache2
ls: /private/var/log/apache2: No such file or directory


What should I do now? Do I just create the directory and make those two files then set the proper perms?

throttlemeister
02-05-2009, 09:04 AM
Just do a mkdir /private/var/log/apache2 and chown -R www:www /private/var/log/apache2 and you should be set; Apache will create its logfiles when it starts up.

cmdshft
02-05-2009, 09:27 AM
Thank you, that got it working again.

Any reason it got borked, though? I don't mess with the logs so I don't know why how they were messed with.

throttlemeister
02-05-2009, 09:31 AM
I have no idea. :) Computers are weird sometimes. Maybe you had a crash at some point, and the disk check upon next boot removed it.

Glad to have been of help. As a former unix admin, this stuff is a lot easier for me than getting my WiFi running under OSX. ;)