Opened 9 years ago

Last modified 15 months ago

#36101 new defect

apache2 @2.2.22_2 startup item

Reported by: grrr@… Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: mountainlion Cc: cooljeanius (Eric Gallager), ctreleaven (Craig Treleaven), lagrave+bugs+macosforge.org@…, jea@…, Schamschula (Marius Schamschula), pixilla (Bradley Giesbrecht), alphanull (alphanull)
Port: apache2

Description

On OS X 10.8.1 after every reboot apache2 is not starting for me, and I have activated the LaunchDaemon.

$ sudo port load apache2
org.macports.apache2: Already loaded

Still no httpd.

Running

$ sudo apachectl start

successfully starts Apache, until reboot.

I've tried uninstalling and reinstalling apache2, running the launchctl load/unload commands on org.macports.apache2.plist, and checked my Apache config with apachectl configtest. Other MacPorts startup items work (MySQL5, dnsmasq), just not Apache.

Change History (15)

comment:1 Changed 9 years ago by ryandesign (Ryan Schmidt)

Keywords: mountainlion added; apache2 removed
Owner: changed from macports-tickets@… to ryandesign@…

Interesting. Since upgrading to Mountain Lion apache2 was also not starting for me and I had not yet spent the time to investigate why. If anybody knows why please let me know. Does the console say anything about it?

comment:2 Changed 9 years ago by grrr@…

I don't see anything in the console, even after changing launchctl's log level (sudo launchctl log level debug).

comment:3 Changed 9 years ago by grrr@…

I apparently fixed this when changing my local dnsmasq config. In /etc/hosts I added my servername (gala) to the loopback entry:

127.0.0.1   localhost gala

and then I changed ServerName in /opt/local/apache2/conf/httpd.conf to match:

ServerName gala

Apache now starts at boot for me.

comment:4 Changed 9 years ago by j+macports@…

I've had this same problem on Lion with various versions of apache2 for many months. Nothing obvious in the Console related to either launchd/apache/httpd.

Ryan, if there's anything I can do or test or any logs I can try and get to help you let me know.

Last edited 9 years ago by j+macports@… (previous) (diff)

comment:5 Changed 9 years ago by j+macports@…

I'm starting to wonder if the reason apache2 fails to actual start despite the fact that launchctl shows that the port has loaded is that the DNS is not fully operational at the time apache2 tries to start and thus fails because of servername mis-match (my machine is it's own DNS server with an internal-only domain name). Does anyone know if there is a good way to somehow delay when the apache2 launchd item tries to execute?

comment:6 Changed 9 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:7 Changed 8 years ago by ctreleaven (Craig Treleaven)

Cc: ctreleaven@… added

Cc Me!

comment:8 Changed 8 years ago by ctreleaven (Craig Treleaven)

Another workaround is to 'sudo port unload apache2' and then 'sudo port load apache2'.

comment:9 Changed 7 years ago by lagrave+bugs+macosforge.org@…

Cc: lagrave+bugs+macosforge.org@… added

Cc Me!

comment:10 Changed 7 years ago by jea@…

Cc: jea@… added

Cc Me!

comment:11 Changed 4 years ago by jmroot (Joshua Root)

Cc: Schamschula pixilla added

comment:12 Changed 16 months ago by alphanull (alphanull)

I have the same problem since years now, and it is quite annoying! Would be nice if we could solve this once and for all, since there seem to be more users affected. I also have some local DNS Server on my router, so this might be a common culprit? All possible workarounds (editing hosts file, delayed startup like described here: https://stackoverflow.com/questions/2042992/macports-apache2-stopped-launching-on-boot) did not work for me. Of course I am willing to help, so if there is anything I can do / test please let me know.

And if there is only a "hacky" workaround for the moment, like stopping / restarting httpd automatically by some script, than having it to do manually after each restart, I will gladly take it.

comment:13 Changed 16 months ago by ryandesign (Ryan Schmidt)

Cc: alphanull added

alphanull, which macOS version are you using? Does the apache error log show anything of note after a system startup -- anything to indicate that it started and then stopped due to some problem?

comment:14 Changed 15 months ago by alphanull (alphanull)

First of all, thanks for responding so quickly!

So I am using Catalina 10.15.5 right now, but the problem bugs me since at least High Sierra (also on another machine) and I actually hoped it would go away with the upgrade ....

So I cleared both access_log and error_log and restarted the machine. Directly after logging in there were no messages whatsoever (file weren't even recreated), and when I do the typical "unload / load" dance, I get this in error_log:

[Thu Jun 18 13:31:27.234114 2020] [mpm_event:notice] [pid 955:tid 4466769344] AH00489: Apache/2.4.43 (Unix) OpenSSL/1.1.1g configured -- resuming normal operations
[Thu Jun 18 13:31:27.234447 2020] [core:notice] [pid 955:tid 4466769344] AH00094: Command line: '/opt/local/sbin/httpd'

Doesn't look like there is anything wrong, but still it does not work correctly. Doing "apachectl -t" give me "Syntax OK" which of course is also nothing suspicious.

Any other idea where to look?

comment:15 Changed 15 months ago by alphanull (alphanull)

Next, I tried to start over from scratch, with a completely new installation. And look, it worked! So I dug through my config step by step - which is relatively complex - until I found the culprit. Turns out it was some includes in some of my vhosts (which share a lot of the same basic configuration, so I thought includes would prevent redundant configs):

Include  /Volumes/Daten/Users/Frank/Sites/projects/test/apache.include.conf

It seems it does not matter what is inside those included files, it won't work even when trying to include a completely empty file! But still I have no idea why this behavior occurs, and why Apache fails completely silently, with no error log at all. Also in this case Apache does not only fail on those vhosts, but also with anything else (even if my oher vhosts do not have such includes)

Any ideas what went wrong here? Well, at least I have a workaround now!

Note: See TracTickets for help on using tickets.