6

I use the systemctl to restart the httpd, but failed:

[root@controller ~]# systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

And I status it, get the below information:

   [root@controller ~]# systemctl status httpd.service
   httpd.service - The Apache HTTP Server
       Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Wed 2017-07-12 15:48:35 CST; 11s ago
         Docs: man:httpd(8)
               man:apachectl(8)
      Process: 10093 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
      Process: 10091 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
     Main PID: 10091 (code=exited, status=1/FAILURE)

    Jul 12 15:48:35 controller httpd[10091]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:5000
    Jul 12 15:48:35 controller httpd[10091]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:5000
    Jul 12 15:48:35 controller httpd[10091]: no listening sockets available, shutting down
    Jul 12 15:48:35 controller httpd[10091]: AH00015: Unable to open logs
    Jul 12 15:48:35 controller systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
    Jul 12 15:48:35 controller kill[10093]: kill: cannot find process ""
    Jul 12 15:48:35 controller systemd[1]: httpd.service: control process exited, code=exited status=1
    Jul 12 15:48:35 controller systemd[1]: Failed to start The Apache HTTP Server.
    Jul 12 15:48:35 controller systemd[1]: Unit httpd.service entered failed state.
    Jul 12 15:48:35 controller systemd[1]: httpd.service failed.

I use the journalctl -xe:

root@controller httpd]# journalctl -xe
Jul 12 16:06:43 controller systemd[1]: Unit httpd.service entered failed state.
Jul 12 16:06:43 controller systemd[1]: httpd.service failed.
Jul 12 16:06:43 controller polkitd[1056]: Unregistered Authentication Agent for unix-process:10390:2078277 (system bus name :1.159, object path /org/freedesktop/PolicyKit1/Authent
Jul 12 16:06:53 controller polkitd[1056]: Registered Authentication Agent for unix-process:10405:2079366 (system bus name :1.160 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Jul 12 16:06:53 controller systemd[1]: Reloading.
Jul 12 16:06:53 controller systemd[1]: [/usr/lib/systemd/system/memcached.service:43] Unknown lvalue 'MemoryDenyWriteExecute' in section 'Service'
Jul 12 16:06:53 controller systemd[1]: Configuration file /usr/lib/systemd/system/auditd.service is marked world-inaccessible. This has no effect as configuration data is accessib
Jul 12 16:06:54 controller systemd[1]: Configuration file /usr/lib/systemd/system/wpa_supplicant.service is marked executable. Please remove executable permission bits. Proceeding
Jul 12 16:06:54 controller polkitd[1056]: Unregistered Authentication Agent for unix-process:10405:2079366 (system bus name :1.160, object path /org/freedesktop/PolicyKit1/Authent
Jul 12 16:06:55 controller polkitd[1056]: Registered Authentication Agent for unix-process:10421:2079560 (system bus name :1.161 [/usr/bin/pkttyagent --notify-fd 5 --fallback], ob
Jul 12 16:06:55 controller systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit httpd.service has begun starting up.
Jul 12 16:06:55 controller httpd[10426]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:5000
Jul 12 16:06:55 controller httpd[10426]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:5000
Jul 12 16:06:55 controller httpd[10426]: no listening sockets available, shutting down
Jul 12 16:06:55 controller httpd[10426]: AH00015: Unable to open logs
Jul 12 16:06:55 controller systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 12 16:06:55 controller kill[10428]: kill: cannot find process ""
Jul 12 16:06:55 controller systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 12 16:06:55 controller systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit httpd.service has failed.
-- 
-- The result is failed.
Jul 12 16:06:55 controller systemd[1]: Unit httpd.service entered failed state.
Jul 12 16:06:55 controller systemd[1]: httpd.service failed.
Jul 12 16:06:55 controller polkitd[1056]: Unregistered Authentication Agent for unix-process:10421:2079560 (system bus name :1.161, object path /org/freedesktop/PolicyKit1/Authent
lines 1377-1410/1410 (END)

And in the /var/log/httpd/ directory, there is no logs here.


EDIT-1

And I find the 5000 port, get the below information:

[root@controller selinux]# netstat | grep 5000
[root@controller selinux]#

EDIT-2

In the /var/www/ directory:

[root@controller www]# ls
cgi-bin  html

both the cgi-bin and html is empty.


EDIT-3

the httpd.conf file contents under the /etc/httpd/conf/:

ServerRoot "/etc/httpd"

Listen 80

Include conf.modules.d/*.conf

User apache
Group apache

ServerAdmin root@localhost


ServerName controller

<Directory />
    AllowOverride none
    Require all denied
</Directory>


DocumentRoot "/var/www/html"


<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
<Directory "/var/www/html">

    Options Indexes FollowSymLinks

    AllowOverride None

    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>


<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

</IfModule>


<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule mime_module>

    TypesConfig /etc/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

AddDefaultCharset UTF-8

<IfModule mime_magic_module>

    MIMEMagicFile conf/magic
</IfModule>


EnableSendfile on

IncludeOptional conf.d/*.conf

EDIT-4

The /var/log/httpd limits is below:

[root@controller system]# ll -d /var/log/httpd
drwx------. 2 root root 6 Nov 20  2015 /var/log/httpd

EDIT-5

I check the port 5000:

[root@controller httpd]# ps -aux | grep 5000
rabbitmq   8710  0.9  0.9 2348444 78620 ?       Ssl  14:39   1:25 /usr/lib64/erlang/erts-7.3.1.2/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -K true -- -root /usr/lib64/erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.5/ebin -noshell -noinput -s rabbit boot -sname rabbit@controller -boot start_sasl -config /etc/rabbitmq/rabbitmq -kernel inet_default_connect_options [{nodelay,true}] -sasl errlog_type error -sasl sasl_error_logger false -rabbit error_logger {file,"/var/log/rabbitmq/[email protected]"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/[email protected]"} -rabbit enabled_plugins_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.5/plugins" -rabbit plugins_expand_dir "/var/lib/rabbitmq/mnesia/rabbit@controller-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/rabbit@controller" -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672
root      11787  0.0  0.0 112644   952 pts/1    S+   17:13   0:00 grep --color=auto 5000

EDIT-6

I use the semanage to add the port 5000:

[root@controller httpd]# semanage port -a -t http_port_t -p tcp 5000
ValueError: Port tcp/5000 already defined

EDIT-7

In the directory /usr/lib/systemd/system/, there is httpd.service here:

[root@controller system]# pwd
/usr/lib/systemd/system
[root@controller system]# ls | grep http
httpd.service
2
  • @jx12345 what do yuo mean? my httpd is combined with the openstack's keystone, and memcached.
    – lustre
    Jul 12, 2017 at 8:27
  • edit 3 worked for me.. Thanks.. I had to remove one line "IncludeOptional sites-enabled/*.conf " at the last.. which i added following "digitalocean.com/community/tutorials/…" method .. is that OKAY?
    – MFarooqi
    Jan 21, 2021 at 14:00

3 Answers 3

3

I saw your environment is development, not production.

So set the selinux permissive model can be help.

Follow the steps:

# getenforce
# setenforce 0   // there will print `Permissive`
# systemctl start  httpd.service

Check it :

systemctl status  httpd.service
2
  • This works for me, but as val0x00ff said, we should enable the selinux, how to do with that?
    – lustre
    Jul 12, 2017 at 16:12
  • You save my day! I was deleted all logs folder (bad idea)... Jul 21, 2020 at 22:08
3

This problem is caused due to SELinux not allowing apache to connect on port 5000

This is what systemctl status httpd.service is showing you:

Jul 12 15:48:35 controller httpd[10091]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:5000
Jul 12 15:48:35 controller httpd[10091]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:5000

To fix this you need to add port 5000 to http_port_t type definition as follow:

semanage port -a -t http_port_t -p tcp 5000

Since port 5000 has already been defined, you need to use -m. To do so, use

semanage port -m -t http_port_t -p tcp 5000

Note! If port 5000 is already assigned to another service type definition you won't be able to assign this port to http_port_t type definition. In other words, you'd need to use another port since SELinux policy won't allow it.

8
  • But I was disabled the selinux in the config file:SELINUX=disabled
    – lustre
    Jul 12, 2017 at 8:44
  • If I disabled the selinux, so the -bash: semanage: command not found ?
    – lustre
    Jul 12, 2017 at 8:45
  • 1
    @lustre disabling SELinux is a bad idea. It was not designed to be disabled. Please enable it, run the above command and update your question. Show us your httpd.conf file, relevant directives, logs etc. Permissions of /var/log/httpd and so on. Jul 12, 2017 at 8:51
  • I am use this as develop environment so I close the SELINUX, my httpd.conf is in the Edit-3.
    – lustre
    Jul 12, 2017 at 9:06
  • the EDIT-5 maybe help.
    – lustre
    Jul 12, 2017 at 9:14
0

I had the same issue when I added an ssl conf under /etc/httpd/conf.d by copying the ssl.conf, but leaving the original behind.

By moving it to ssl.conf.bak the error went away.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .