Control Web Panel

WebPanel => CentOS 7 Problems => Topic started by: Verto on December 15, 2023, 09:11:04 PM

Title: Job for httpd.service failed
Post by: Verto on December 15, 2023, 09:11:04 PM
Hello, Please, I need urgent help to recover a downed server, which I am unable to recover on my own, nor do I think I have the knowledge to do so.

The error seems to report a conflict on port 80, which is occupied by Apache or by NGINX, but both have stopped working together.

My server was configured as Nginx & Varnish & Apache. But Apache won't start now and I have several websites down.

I have tried to restart everything, both the services and the server, but the problem is not solved and if I try to start Apache, I get this error:

"Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details."

Title: Re: Job for httpd.service failed
Post by: rcschaff on December 15, 2023, 09:43:26 PM
Please run the following commands

netstat -lp | grep 80
journalctl -xe -u nginx
journalctl -xe -u apache2
Title: Re: Job for httpd.service failed
Post by: Verto on December 15, 2023, 09:56:19 PM
My impatience to solve the problem and recover the downed sites, I think, has aggravated the situation.

Not knowing what to do, I decided to rebuild the server configuration from WebServer Settings/Select WebServers/ Nginx & Varnish & Apache, but the error kept occurring and in the end I discovered that Nginx and Apache were trying to use the same port. So I configured the ports correctly, and now I have managed to get the server to start. But I still have a problem, because it doesn't seem to point to any of the domains, as it doesn't show the contents of the directories where the sites are hosted. It always shows a 404 error, except in one of the domains where it shows an Apache test page.
Title: Re: Job for httpd.service failed
Post by: rcschaff on December 15, 2023, 10:02:42 PM
If you allowed CWP to rebuild the servers, it should have change apache to port 8080 automatically.  If however you installed a different version of apache, it may not work correctly.
Title: Re: Job for httpd.service failed
Post by: Verto on December 15, 2023, 10:14:27 PM
Well, the truth is that I could not say. I just pressed the rebuild button, without modifying anything else. I understand that the rebuild had to be done with the configuration that I had previously, but the truth is that then I had to manually modify the ports, because I had assigned port 80 to Nginx and Apache.

How could I solve the problem?

I have several sites, which cannot be accessed right now.

Title: Re: Job for httpd.service failed
Post by: rcschaff on December 15, 2023, 10:33:30 PM
I would rebuild the configuration Apache only to see if it get's working, and disable NGINX temporarily.  Then if that works, rebuild with your current config
Title: Re: Job for httpd.service failed
Post by: Verto on December 15, 2023, 10:54:17 PM
I've rebuilt it, and I've tried configuring just nginx as well, but it still doesn't direct to the directories where the websites are hosted. I don't know what else to do.

Title: Re: Job for httpd.service failed
Post by: rcschaff on December 15, 2023, 10:58:53 PM
post your httpd.conf and your nginx.conf
Title: Re: Job for httpd.service failed
Post by: Verto on December 15, 2023, 11:37:40 PM
I can't. The forum won't let me upload attachments, nor will it let me post the code for the files. It is returning an error stating that I am not authorized, when I try to post it.

Title: Re: Job for httpd.service failed
Post by: overseer on December 15, 2023, 11:47:52 PM
use Pastebin or another temp hosting service to share the contents.
Title: Re: Job for httpd.service failed
Post by: Verto on December 16, 2023, 12:07:31 PM
Sorry.

nginx.conf: https://pastebin.com/6bJyrH8c

httpd.conf: https://pastebin.com/vfrQBC4r
Title: Re: Job for httpd.service failed
Post by: rcschaff on December 16, 2023, 12:41:08 PM
Your https.conf tells me that your Apache is not the cwp installed version.  The Apache version for cwp should be installed under /usr/local/apache
Title: Re: Job for httpd.service failed
Post by: rcschaff on December 17, 2023, 05:31:28 AM
Let's start by remove apache.

run from shell:

yum remove httpd apache2



Then try to reconfigure the servers from CWP Admin
Title: Re: Job for httpd.service failed
Post by: vsbradsmith on March 17, 2025, 07:33:17 PM
im having a simlar problem and i have not made any changes and it just failed and i needed to roll back. i did find that there was an SSL problem also. im wondering would data and time have anything to do with it?
Title: Re: Job for httpd.service failed
Post by: Starburst on March 18, 2025, 01:24:41 PM
And this is why you should make a snapshot BEFORE making any major changes to a server.
Software and/or Hardware.
Title: Re: Job for httpd.service failed
Post by: MixTecnico on March 19, 2025, 08:17:02 PM
I'm having this same problem recently, and I have a little more documentation, since I have a snapshot, where upon updating, they are dependent on each other.


It generates the following errors. Without updating this, the server operates normally, running


(https://ihost.com.ar/UTI/ERROR_HTTPD/UP_CWP.png)

The error starts with Apache and the FQDN. After a reboot, the reverse proxy fails with various errors and ports are busy, as if it were a different installation.

(https://ihost.com.ar/UTI/ERROR_HTTPD/ERROR_APACHE.png)

Code: [Select]
WARNING!
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2025-03-19 15:55:21 -03; 11s ago
  Process: 1478 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
  Process: 981 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 971 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Mar 19 15:55:19 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:80 failed (98: Address already in use)
Mar 19 15:55:19 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:443 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:80 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:443 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:80 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:443 failed (98: Address already in use)
Mar 19 15:55:21 example.host.xxx nginx[1478]: nginx: [emerg] still could not bind()
Mar 19 15:55:21 example.host.xxx systemd[1]: nginx.service: Control process exited, code=exited status=1
Mar 19 15:55:21 example.host.xxx systemd[1]: nginx.service: Failed with result 'exit-code'.
Mar 19 15:55:21 example.host.xxx systemd[1]: Failed to start The nginx HTTP and reverse proxy server.



After a reboot, NGIXN fails.

(https://ihost.com.ar/UTI/ERROR_HTTPD/ERROR_NGIXN.png)

Code: [Select]
WARNING!
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2025-03-19 15:55:21 -03; 11s ago
  Process: 1478 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
  Process: 981 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 971 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Mar 19 15:55:19 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:80 failed (98: Address already in use)
Mar 19 15:55:19 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:443 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:80 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:443 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:80 failed (98: Address already in use)
Mar 19 15:55:20 example.host.xxx nginx[1478]: nginx: [emerg] bind() to 192.168.88.240:443 failed (98: Address already in use)
Mar 19 15:55:21 example.host.xxx nginx[1478]: nginx: [emerg] still could not bind()
Mar 19 15:55:21 example.host.xxx systemd[1]: nginx.service: Control process exited, code=exited status=1
Mar 19 15:55:21 example.host.xxx systemd[1]: nginx.service: Failed with result 'exit-code'.
Mar 19 15:55:21 example.host.xxx systemd[1]: Failed to start The nginx HTTP and reverse proxy server.

Do you have any idea where the problem could be?
Title: Re: Job for httpd.service failed
Post by: overseer on March 19, 2025, 09:34:42 PM
Run this to see what is occupying the httpd ports:
Code: [Select]
lsof -i :80
lsof -i :443
Title: Re: Job for httpd.service failed
Post by: MixTecnico on March 19, 2025, 10:01:20 PM
Run this to see what is occupying the httpd ports:
Code: [Select]
lsof -i :80
lsof -i :443

I'm replicating the error now to respond based on what you ask!

Apache uses them, as far as I understand and see.


Code: [Select]
[root@lion ~]# lsof -i :80
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd    953   root    4u  IPv6  27937      0t0  TCP *:http (LISTEN)
httpd   1212 apache    4u  IPv6  27937      0t0  TCP *:http (LISTEN)
httpd   1213 apache    4u  IPv6  27937      0t0  TCP *:http (LISTEN)
httpd   1214 apache    4u  IPv6  27937      0t0  TCP *:http (LISTEN)
httpd   2870 apache    4u  IPv6  27937      0t0  TCP *:http (LISTEN)



Code: [Select]
[root@lion ~]# lsof -i :443
COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd    953   root    6u  IPv6  27945      0t0  TCP *:https (LISTEN)
httpd   1212 apache    6u  IPv6  27945      0t0  TCP *:https (LISTEN)
httpd   1213 apache    6u  IPv6  27945      0t0  TCP *:https (LISTEN)
httpd   1214 apache    6u  IPv6  27945      0t0  TCP *:https (LISTEN)
httpd   1214 apache   18u  IPv6  29624      0t0  TCP example.host.xxx:https->172.71.234.207:51248 (ESTABLISHED)
httpd   2870 apache    6u  IPv6  27945      0t0  TCP *:https (LISTEN)



This is the error after rebooting, which I forgot to mention before...

Code: [Select]
WARNING!
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2025-03-19 18:50:29 -03; 6min ago
     Docs: man:httpd.service(8)
 Main PID: 953 (httpd)
   Status: "Total requests: 66; Idle/Busy workers 100/0;Requests/sec: 0.17; Bytes served/sec: 838 B/sec"
    Tasks: 278 (limit: 73297)
   Memory: 64.6M
   CGroup: /system.slice/httpd.service
           ├─ 953 /usr/sbin/httpd -DFOREGROUND
           ├─1209 /usr/sbin/httpd -DFOREGROUND
           ├─1212 /usr/sbin/httpd -DFOREGROUND
           ├─1213 /usr/sbin/httpd -DFOREGROUND
           ├─1214 /usr/sbin/httpd -DFOREGROUND
           └─2870 /usr/sbin/httpd -DFOREGROUND

Mar 19 18:50:29 example.host.xxx systemd[1]: Starting The Apache HTTP Server...
Mar 19 18:50:29 example.host.xxx httpd[953]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using example.host.xxx Set the 'ServerName' directive globally to suppress this message
Mar 19 18:50:29 example.host.xxx systemd[1]: Started The Apache HTTP Server.
Mar 19 18:50:29 example.host.xxx httpd[953]: Server configured, listening on: port 443, port 80
Title: Re: Job for httpd.service failed
Post by: Starburst on March 19, 2025, 10:15:36 PM
Where are your IPv4?

CWP doesn't use the >RPM for Apache, CWP builds it from source.
So it showing those a new Apache .rpm files are available for install is concerning.

Also looks like you are behind a NAT.
Title: Re: Job for httpd.service failed
Post by: MixTecnico on March 19, 2025, 10:24:51 PM
Where are your IPv4?

CWP doesn't use the >RPM for Apache, CWP builds it from source.
So it showing those a new Apache .rpm files are available for install is concerning.

Also looks like you are behind a NAT.


I'm behind a MKT.

The problem occurs after updating. As you indicate, it's a different version, which is causing the conflict.


I don't know if this helps, but no changes have been made since the clean install, other than updating MariaDB to version 10.11.

Code: [Select]
[root@lion ~]# yum repolist
id del repositorio                                             nombre del repositorio
appstream                                                      AlmaLinux 8 - AppStream
baseos                                                         AlmaLinux 8 - BaseOS
cwp                                                            CentOS Web Panel repo for Linux 8 - x86_64
epel                                                           Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                   Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                                         AlmaLinux 8 - Extras
mariadb                                                        MariaDB
nginx                                                          nginx repo
pgdg-common                                                    PostgreSQL common RPMs for RHEL / Rocky / AlmaLinux 8 - x86_64
pgdg12                                                         PostgreSQL 12 for RHEL / Rocky / AlmaLinux 8 - x86_64
pgdg13                                                         PostgreSQL 13 for RHEL / Rocky / AlmaLinux 8 - x86_64
pgdg14                                                         PostgreSQL 14 for RHEL / Rocky / AlmaLinux 8 - x86_64
pgdg15                                                         PostgreSQL 15 for RHEL / Rocky / AlmaLinux 8 - x86_64
pgdg16                                                         PostgreSQL 16 for RHEL / Rocky / AlmaLinux 8 - x86_64
pgdg17                                                         PostgreSQL 17 for RHEL / Rocky / AlmaLinux 8 - x86_64
powertools                                                     AlmaLinux 8 - PowerTools
powertools-debuginfo                                           AlmaLinux 8 - PowerTools debuginfo
powertools-source                                              AlmaLinux 8 - PowerTools Source
varnishcache_varnish64                                         varnishcache_varnish64
varnishcache_varnish64-source                                  varnishcache_varnish64-source

Title: Re: Job for httpd.service failed
Post by: MixTecnico on March 19, 2025, 10:38:29 PM
It's not an IP redirection issue, since if I restore the snapshot, everything works normally...

It only happens when updating those packages...

I sent you the list of repositories in case you see anything wrong.
Title: Re: Job for httpd.service failed
Post by: overseer on March 20, 2025, 12:08:52 AM
Starburst was making a point that on your system, Apache (httpd) is only running on IPv6, not on IPv4. Is your server set up for IPv4 & IPv6 co-existing, or did you configure it to only handle IPv6? Mine is actually configured to disable IPv6. (Probably on the next major OS EOL cycle I will re-enable IPv6 and have co-existing protocols.)
Title: Re: Job for httpd.service failed
Post by: MixTecnico on March 20, 2025, 02:24:48 AM
Starburst was making a point that on your system, Apache (httpd) is only running on IPv6, not on IPv4. Is your server set up for IPv4 & IPv6 co-existing, or did you configure it to only handle IPv6? Mine is actually configured to disable IPv6. (Probably on the next major OS EOL cycle I will re-enable IPv6 and have co-existing protocols.)

Yes, I noticed that, it was always in IPv4...

The error only occurs if I apply those updates...

After updating, I just tried disabling IPv6 with

Code: [Select]
sudo nmtui
But the problem persists. I cloned the VM so I could try whatever you suggested.

In the instance without the updates, IPv6 coexists, but the configuration is all under IPv4.

And the strangest thing is that it tells me the ports are already in use after updating those packages.
Title: Solved: Job for httpd.service failed
Post by: MixTecnico on March 20, 2025, 05:02:23 AM
I've apparently solved the problem. In case it helps anyone or has the same problem, here's the solution!

After much trial and error, the solution was much simpler than I thought, with the following command.

Code: [Select]
yum remove cwp-httpd httpd* -y && yum install cwp-httpd -y
I'll be testing it for a couple of days in the development environment, and if there are no problems, I'll apply it to production...

Thanks a lot for the guidance

I always follow your posts.