LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem starting Apache httpd (https://www.linuxquestions.org/questions/linux-newbie-8/problem-starting-apache-httpd-4175418561/)

KeithBoynton 07-25-2012 05:30 AM

Problem starting Apache httpd
 
Hi folks,

I'm experiencing a really strange issue when trying to start apache on a CentOS virtual machine.

Installed Apache httpd is the latest version and I've configured it to Listen on 0.0.0.0:81, there are no VirtualHosts in the configuration. It's a fresh install of both the OS and Apache so it hasn't been upgraded.

I receive the following error when trying to start apache using "sudo apachectl -k start".
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs

I'm aware that root is required for port 81, hence the sudo however, I'm also logged in as root.

There is nothing already listening on port 81, confirmed by doing a fuser 81/tcp (or fuser 81/udp for that matter)

No logs are getting created which is making me suspicious that something more serious is the problem.

I'm really stuck and hope someone has some ideas that can help.

rmugunthan 07-25-2012 05:57 AM

Instead of 0.0.0.0 try with the server IP Address or only mention port number.

Example :

Listen 81
(or)
Listen 192.168.0.1:81

rosehosting.com 07-25-2012 06:19 AM

Open your Apache configuration file (/etc/httpd/conf/httpd.conf) in a text editor and add/modify the following line:

Listen 81

Then, restart your Apache service for the changes to take effect using the following command:

service httpd restart

KeithBoynton 07-25-2012 06:59 AM

Thanks very much for the suggestions guys but I'd already tried that.

With just Listen 81

[root@teamsite-vm ~]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs
[FAILED]

With Listen 192.168.48.135:81

[root@teamsite-vm ~]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: (13)Permission denied: make_sock: could not bind to address 192.168.48.135:81
no listening sockets available, shutting down
Unable to open logs
[FAILED]

rosehosting.com 07-25-2012 07:02 AM

Execute the following command:

semanage port -a -t http_port_t -p tcp 81

Then, try to start your Apache service.

KeithBoynton 07-25-2012 08:02 AM

Thanks again for the suggestions.

"semanage port -a -t http_port_t -p tcp 81" does indeed work, thanks for that. Do I need anything to persist that across reboots?

rosehosting.com 07-25-2012 08:21 AM

The changes will still be active after a reboot.

KeithBoynton 07-25-2012 09:01 AM

Thanks very much for your help, much appreciated!


All times are GMT -5. The time now is 11:58 AM.