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

13

23

I have installed a fresh copy of Centos 7. Then I restarted Apache but the Apache failed to start. I have 3 days stucked in this issue. Even the support can not figure out the error.

sudo service httpd start


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


httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2016-05-09 16:08:02 BST; 59s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 5710 (code=exited, status=1/FAILURE)

May 09 16:08:02 mike079.startdedicated.de systemd[1]: Starting The Apache HTTP Server...
May 09 16:08:02 mike079.startdedicated.de httpd[5710]: (98)Address already in use: AH00072: make_sock: could not bind to address 85.25.12.20:80
May 09 16:08:02 startdedicated.de httpd[5710]: no listening sockets available, shutting down
May 09 16:08:02 startdedicated.de httpd[5710]: AH00015: Unable to open logs
May 09 16:08:02 startdedicated.de systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 09 16:08:02.startdedicated.de kill[5712]: kill: cannot find process ""
May 09 16:08:02 .startdedicated.de systemd[1]: httpd.service: control process exited, code=exited status=1
May 09 16:08:02startdedicated.de systemd[1]: Failed to start The Apache HTTP Server.
May 09 16:08:02 startdedicated.de systemd[1]: Unit httpd.service entered failed state.
May 09 16:08:02 mike: httpd.service failed.
Halfbeak answered 9/5, 2016 at 15:19 Comment(0)
P
10

From your output:

no listening sockets available, shutting down

what basically means, that any port in which one apache is going to be listening is already being used by another application.

netstat -punta | grep LISTEN

Will give you a list of all the ports being used and the information needed to recognize which process is so you can kill stop or do whatever you want to do with it.

After doing a nmap of your ip I can see that

80/tcp    open     http

so I guess you sorted it out.

Pacheco answered 10/5, 2016 at 7:18 Comment(3)
Thanks I solved the isse there was missmatch with ports.Halfbeak
I am kind of lost after the line After doing a nmap of your ip ... Could you tell me how should I test after that?Jahncke
@Jahncke nmap ip is the fastest way to goPacheco
C
30

I got the same error because of a simple typo in vhost.conf. Remember to make sure you don't have any errors in the config files.

apachectl configtest
Chicory answered 19/11, 2019 at 20:7 Comment(2)
suggest using "sudo" in front if getting PEM file type errors which may require the elevated prompt to see the files.Phagocyte
If you run httpd in another user account, instead of simply adding sudo you might want to use sudo -u [httpd user] to check file privilege.Hersey
P
10

From your output:

no listening sockets available, shutting down

what basically means, that any port in which one apache is going to be listening is already being used by another application.

netstat -punta | grep LISTEN

Will give you a list of all the ports being used and the information needed to recognize which process is so you can kill stop or do whatever you want to do with it.

After doing a nmap of your ip I can see that

80/tcp    open     http

so I guess you sorted it out.

Pacheco answered 10/5, 2016 at 7:18 Comment(3)
Thanks I solved the isse there was missmatch with ports.Halfbeak
I am kind of lost after the line After doing a nmap of your ip ... Could you tell me how should I test after that?Jahncke
@Jahncke nmap ip is the fastest way to goPacheco
P
10

In my case I got the error simply because I had changed the Listen 80 to listen 443 in the file

/etc/httpd/conf/httpd.conf 

Since I had installed mod_ssl using the yum commands

yum -y install mod_ssl  

there was a duplicate listen 443 directive in the file ssl.conf created during mod_ssl installation.

You can verify this if you have duplicate listen 80 or 443 by running the below command in linux centos (My linux)

grep  '443' /etc/httpd/conf.d/*

below is sample output

/etc/httpd/conf.d/ssl.conf:Listen 443 https
/etc/httpd/conf.d/ssl.conf:<VirtualHost _default_:443>
/etc/httpd/conf.d/ssl.conf:#ServerName www.example.com:443

Simply reverting the listen 443 in httd.conf to listen 80 fixed my issue.

Portmanteau answered 2/10, 2018 at 10:41 Comment(2)
grep '443' /etc/httpd/conf.d/* saved my live. turns out there are ssl.conf and i set vrtual host on the httpd.confSarsen
Saved the day. Is there any way to see the proper error message? apachectl configtest only validates the syntax.Charpentier
A
7

on command line type journalctl -xe and the results will be

SELinux is preventing /usr/sbin/httpd from name_bind access on the tcp_socket port 83 or 80

This means that the SELinux is running on your machine and you need to disable it. then edit the configuration file by type the following

nano /etc/selinux/config

Then find the line SELINUX=enforce and change to SELINUX=disabled

Then type the following and run the command to start httpd

setenforce 0

Lastly start a server

systemctl start httpd
Adela answered 20/8, 2019 at 10:17 Comment(0)
I
4

Allow Apache Through the Firewall

Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:

sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp

And reload the firewall:

sudo firewall-cmd --reload
Interpleader answered 23/1, 2020 at 10:17 Comment(0)
I
2

Some other service may be using port 80: try to stop the other services: HTTPD, SSL, NGINX, PHP, with the command sudo systemctl stop and then use the command sudo systemctl start httpd

Insular answered 4/4, 2020 at 1:28 Comment(1)
sudo systemctl stop HTTPD, sudo systemctl stop SSL, sudo systemctl stop NGINX sudo systemctl stop PHPInsular
E
1

For me the issue was the following:

[Sat Sep 10 00:43:20.999998 2022] [auth_digest:error] [pid 123456] (2)No such file or directory: AH01762: Failed to create shared memory segment on file /run/httpd/authdigest_shm.128124
[Sat Sep 10 00:43:20.999999 2022] [auth_digest:error] [pid 123456] (2)No such file or directory: AH01760: failed to initialize shm - all nonce-count checking and one-time noncesdisabled

I have just tailed the error logs to get those two line above:

*ADMINSHELL* :/var/opt/custom_path/logs/httpd # tail error_log

So the problem was that this folder was missing: /run/httpd/

Solution:

mkdir /run/httpd
chown root:httpd /run/httpd
chmod 0710 /run/httpd

After this is done. You will be able to restart the service:

systemctl restart httpd.service

Double check:

systemctl status httpd.service
Epizootic answered 9/9, 2022 at 23:28 Comment(0)
A
0

The error could be anywhere, configs, libraries or the binaries. Error in the control process is a general error thrown by the system when its not able to start/restart the service. In my case one of libraries linked to the exe in the .service file has a problem. Fixing that library solved the problem.

Accouter answered 5/10, 2021 at 20:52 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Odine
W
0

try this cmd to know the missing config or error in the file configuration $ apachectl configtest

Weariless answered 27/4, 2022 at 11:2 Comment(0)
E
0

I had almost the same error, and I found the error on vhost.conf file, which is located on /etc/httpd/conf.d/vhost.conf.

If you were configuring the virtual host, I suggest you look at the following file and find if you have any errors there.

/etc/httpd/conf.d/vhost.conf

Esophagitis answered 23/6, 2022 at 21:34 Comment(0)
H
0

For me also the same error happens after adding dummy SSL

in /etc/httpd/conf.d/ssl.conf file it's created a line like,

SLCertificateFile /etc/pki/tls/certs/localhost.crt

I changed it from SLCertificateFile to SSLCertificateFile

SSLCertificateFile /etc/pki/tls/certs/localhost.crt

And after apache restart it started working fine.

Hightail answered 14/1, 2023 at 18:52 Comment(0)
G
0

A lot of answers here, but the basic steps to solve this should be:

  1. Check syntax

httpd -t or apachectl configtest

  1. If step 1 returns Syntax OK then something else is wrong...

Assuming journalctl -xeu returned nothing of use, then it's time to hunt down the error logs. The default location is often /var/log/httpd but differs between distributions and your VirtualHost configurations.

Girosol answered 24/5 at 2:23 Comment(0)
N
-2
<VirtualHost *:80>
    ServerName www.YOURDOMAIN.COM
    ServerAlias YOURDOMAIN.COM
    DocumentRoot /var/www/YOURDOMAIN.COM/public_html
    ErrorLog /var/www/YOURDOMAIN.COM/error.log
    CustomLog /var/www/YOURDOMAIN.COM/requests.log combined

    DocumentRoot /var/www/YOURDOMAIN.COM/public_html
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/YOURDOMAIN.COM/public_html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

</VirtualHost>
Neuralgia answered 20/11, 2018 at 9:37 Comment(1)
Please explain more about your solution. Your answer is not helpful for anyone.Noddle

© 2022 - 2024 — McMap. All rights reserved.