日期:2014-05-16  浏览次数:20729 次

Linux下开启apache 8790端口问题解决

服务器环境 CentOS 6.3 Final


1、安装Apach httpd

yum install httpd.x86_64

2、修改apach 端口为8790

vi /etc/httpd/conf/httpd.conf

修改

listen 80 为 listen 8790

3、启动httpd服务

命令执行 service httpd start 报错如下:

[root@SVR01 ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:8790
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:8790
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]

查找原因:参见http://blog.chinaunix.net/uid-7208369-id-2658461.html


执行semanage port -l | grep http查看 SETLinux管理的http端口时,报错如下:

[root@SVR01 ~]# semanage port -l | grep http
-bash: semanage: command not found

没有semanage命令

查找semanage命令的包,执行命令yum provides /usr/sbin/semanage

[root@SVR01 ~]# yum provides /usr/sbin/semanage
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * extras: mirrors.btte.net
 * updates: mirrors.btte.net
policycoreutils-python-2.0.83-19.24.el6.x86_64 : SELinux policy core python utilities
Repo        : base
Matched from:
Filename    : /usr/sbin/semanage

得知为policycoreutils-python-2.0.83-19.24.el6.x86_64

安装policycoreutils-python-2.0.83-19.24.el6.x86_64

[root@SVR01 ~]# yum -y install policycoreutils-python

设置SETLinux管理http的端口

semanage port -a -t http_port_t -p tcp 8790
<