Avatar of Dima Iva
Dima Iva
 asked on

Can't start Apache 2.4 on Windows Server 2019.

I am moving a webserver from Windows Server 2016 to Windows Server 2019.  I am using XAMPP, which works fine on the 2016 VM.  After moving the htdocs folder, as well as the SSL certificate related files (*.crts), I also copied some lines I edited on the old machine to C:\xampp\apache\con\httpd.conf on the new server.  I added Apache2.4 to the list of Windows services, but it doesn't want to start. Here is what XAMPP Control Panel message says:


3:58:19 PM  [Apache]    Attempting to start Apache service...
3:58:59 PM  [Apache]    Attempting to start Apache service...
3:59:00 PM  [Apache]    Status change detected: running 3:59:01 PM  [Apache]    Status change detected: stopped 3:59:01 PM  [Apache]    Error: Apache shutdown unexpectedly. 3:59:01 PM  [Apache]    This may be due to a blocked port, missing dependencies,  3:59:01 PM  [Apache]    improper privileges, a crash, or a shutdown by another method. 3:59:01 PM  [Apache]    Press the Logs button to view error logs and check 3:59:01 PM  [Apache]    the Windows Event Viewer for more clues 3:59:01 PM  [Apache]    If you need more help, copy and post this 3:59:01 PM  [Apache]    entire log window on the forums

Open in new window


At some point, after trying to start the Apache2.4 service, I saw this in C:\xampp\apache\logs\error.log:


[Thu Nov 04 14:13:10.387186 2021] [ssl:warn] [pid 10768:tid 624] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Nov 04 14:13:10.621571 2021] [mpm_winnt:notice] [pid 10768:tid 624] AH00455: Apache/2.4.51 (Win64) OpenSSL/1.1.1l PHP/8.0.12 configured -- resuming normal operations
[Thu Nov 04 14:13:10.621571 2021] [mpm_winnt:notice] [pid 10768:tid 624] AH00456: Apache Lounge VS16 Server built: Oct  7 2021 16:27:02 [Thu Nov 04 14:13:10.621571 2021] [core:notice] [pid 10768:tid 624] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache' [Thu Nov 04 14:13:10.637179 2021] [mpm_winnt:notice] [pid 10768:tid 624] AH00418: Parent: Created child process 7852 [Thu Nov 04 14:13:11.605908 2021] [ssl:warn] [pid 7852:tid 472] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [Thu Nov 04 14:13:11.793390 2021] [mpm_winnt:notice] [pid 7852:tid 472] AH00354: Child: Starting 150 worker threads.

Open in new window

but then I commented out all the lines related to SSL and now I don't see any errors in Apache's error.log and in C:\xampp\php\logs\php_error_log.  In order to troubleshoot, it would be nice to enable logging, but I am not sure where to start.

Windows OSWindows Server 2019Windows Server 2016Apache Web ServerWindows 10

Avatar of undefined
Last Comment
David Favor

8/22/2022 - Mon
Seth Simmons

...but then I commented out all the lines related to SSL and now I don't see any errors in Apache's error.log

www.example.com:443:0 server certificate does NOT include an ID which matches the server name

Open in new window


what is the certificate configured for?  the old host?
if the certificate is for Server1 and you move it to Server2 you would have issues because the host name doesn't match
should work if you decommission the 2016 server, rename the 2019 server as the same name so the certificate matches; otherwise you will need a certificate to match the host name of the 2019 server
Dima Iva

ASKER
The cert was configured for the "journal.mycompany.com" site running on Win 2016.  The idea is to try and copy that website to Win 2019, but I see what you mean by them not going going to be able to be accessible at the same time.  I would be content with applying the cert on 2019 after I make the site up and running w/o SSL enabled, but I need to make the Apache start on 2019 in the first place and I have trouble with that (and not much in the logs).  As I mentioned initially, after commenting out SSL related stuff in httpd.conf, Apache still doesn't run, but it doesn't give any error messages either, so I am not sure what's wrong.  I guess I need to make it log everting in a debug mode or something.

Also, I think I need to delete the Apache folder and start from a vanilla one and see whether it starts a Windows service and then add my virtual hosts and other config changes I applied on 2016, one by one, to see where it fails.  Does that sound as a valid path or is there a better/easier way?
David Favor

1) The most important question is if Apache started when you commented out the SSL lines.

Seems like it doesn't.

Since the SSL log entries you mentioned are warnings... seen on almost every Apache instance, independent of OS... I wouldn't expect for commenting these lines out to have any effect.

Remove certs from any consideration of this problem + best leave certs commented out till you fix the real problem.

2) You're running Apache/2.4.51 which is very good, so you're running latest Apache with almost every patch applied.

So it's unlikely you're hitting any Apache bug.

3) The file C:\xampp\apache\logs\error.log seems incomplete, as last line shows a child process starting, then additional error logged related to a crash.

So clear your error.log file (zero it out)... then restart Apache again... then attach 100% of the error log...

If Apache really died, then there will be an indication in the error.log file of some sort as last line of this log file.

4) You might check to see if Apache is really running + XAMPP is confused.

Running AMP on Windows is always a... Thrillseekers game, so just work through this one step at a time.

5) Another trick you can use, is to just comment out your journal.mycompany.com config.... which is hopefully modularized into it's own file, which makes enable/disable of sites trivial.

If you comment out your journal.mycompany.com config + Apache starts with the default config, then you know something's requires fixing in your host config file.

6) One other random item...

Apache-2.2 != Apache-2.4

So if you also went from Apache-2.2 -> Apache-2.4 then you must hand edit all your config files before any sites will serve content.

I've never seen a config mismatch crash Apache before.

The normal behavior of this problem is Apache starts, then no content serves.

The problem normally relates to ACLs.

https://httpd.apache.org/docs/2.4/upgrading.html goes over each config line to change.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Dr. Klahn

In addition to what David has said above, let me offer an opinion:

<opinion>
Apache is a poor fit on Windows.  Yes, the basic server can be made to run on Windows.  Anything more than that is asking for trouble.

Apache was created in the linux environment and to a large extent it is targeted at linux alone.  Trying to make Apache run on Windows is like trying to fit a Rolls Royce Merlin engine into a Cessna 152.  It can be done, but it's a one-off customization each time, the result is unsupportable due to the many customizations (therefore the guy who did it must stay with the company forever or the dogs of war will eventually break loose), and it would be far better off back in the Supermarine Spitfire that it came from.

Aside from that, many of the useful third-party Apache modules are for linux only.
</opinion>
ASKER CERTIFIED SOLUTION
Dima Iva

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.