Here are the detailed steps if its already installed
check if its already installed
# httpd -v (you may get command not found ,so try this too)
# whereis httpd (output in my machine /usr/sbin/httpd ) so using the output where the command is
# /usr/sbin/httpd -v
This should give some output if its already installed like
Server version: Apache/2.2.3
Server built: May 2 2012 13:21:52
====Now checking part is done =============
Configure
# sudo /etc/httpd/conf/httpd.conf
It throws this error
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs [FAILED]
The problem here is that the port is used by some other service or something ,so either you have to kill it or configure new port on which httpd can be used or apache.(I prefer the latter as no risk in that)
For killing
# ps -aux | grep httpd
Find the pid which is using this
# kill -9 //make sure you don't kill any important process
Configuring new port
check if its already installed
# httpd -v (you may get command not found ,so try this too)
# whereis httpd (output in my machine /usr/sbin/httpd ) so using the output where the command is
# /usr/sbin/httpd -v
This should give some output if its already installed like
Server version: Apache/2.2.3
Server built: May 2 2012 13:21:52
====Now checking part is done =============
Configure
# sudo /etc/httpd/conf/httpd.conf
It throws this error
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs [FAILED]
The problem here is that the port is used by some other service or something ,so either you have to kill it or configure new port on which httpd can be used or apache.(I prefer the latter as no risk in that)
For killing
# ps -aux | grep httpd
Find the pid which is using this
# kill -9
Configuring new port
Run this command
# sudo semanage port -l | grep -w http_port_t ( To view the ports SELinux allows httpd to listen on:)
O/p on machine is 80, 443, 488, 8008, 8009, 8443
Edit /etc/httpd/conf/httpd.conf as the root user. Configure the Listen option so it lists a port that is not configured in SELinux policy configuration for httpd like 12345
Go here and add Listening port info
# sudo vi /etc/httpd/conf/httpd.conf
Add this line
Listen 127.0.0.1:12345
Now you have to configure SELinux to allow httpd to listen on port 12345,use this command
# sudo semanage port -a -t http_port_t -p tcp 12345
Start apache again
# sudo /etc/rc.d/init.d/httpd start
Note : 1. You may hav to add /usr/sbin and /usr/bin in your path if its not already
2. You can set SELinux disabled using setenforce 0 command though never advisable.
====Done=====
No comments:
Post a Comment