Having trouble starting/restarting httpd (apache)

12,482

You've most likely got SELinux enabled and in "enforcing" mode.

You can disable it with:

sudo setenforce 0

You can then start apache as normal with

sudo service httpd start

If you want to disable SELinux permanently, edit /etc/selinux/config and change SELINUX=enforcing to SELINUX=disabled

If you want to continue using SELinux, you'll need to fix your config by adding access to the port, with something along the lines of

sudo semanage port -a -t http_port_t -p tcp 8888
Share:
12,482

Related videos on Youtube

Rick
Author by

Rick

Updated on September 18, 2022

Comments

  • Rick
    Rick over 1 year

    I rebooted my server and now the httpd will not restart.

    I tried using the command "service httpd start" but get this in response

    [root@mail ~]# sudo service httpd start
    Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:8888
    (13)Permission denied: make_sock: could not bind to address 0.0.0.0:8888
    no listening sockets available, shutting down
    Unable to open logs
    

    I am logged in as root. I have no directory in my ect directory called conf to find conf/httpd.conf nor do I have init.d/apache2 in my ect directory. I looked at my ect/init.d file but see nothing about ports.

    I have a lot to learn but in the meantime I need to get this back up and running. Thanks for any help.

    • Dan
      Dan about 10 years
      Something is already bound port 8888. Running "netstat -tulpn | grep :8888" should tell you the name of process using the port.
    • Rick
      Rick about 10 years
      [root@mail ~]# netstat -tulpn | grep :8888 [root@mail ~]# I get nothing :(
    • Dan
      Dan about 10 years
      Sorry, I didn't read the error properly. It's not a bound port problem, it's an SELinux problem. Solution detailed in answer below.
  • Rick
    Rick about 10 years
    This is on the right track. I did this right before you answered and can now get httpd to start. However, apachectl -k restart just returns a new line and nothing else.