您的位置:首页 > 运维架构 > Linux

centos启动php-fpm不使用默认9000端口Permission denied

2015-11-18 23:02 477 查看
今天终于有时间想自己撘一套LNMP开发环境,由于之前的开发环境都是公司现有的,用的时候改改配置就OK了,感觉很轻松的,但是自己亲自动手从安装虚拟机到最后一步步搭建LNMP,竟然困难重重,务必脚踏实地,绝对不能眼高于顶。

言归正传,就在按照前辈的博文,一步步yum完了nginx和php-fpm之后,想要将项目用的fastcgi端口改为非默认的90001的时候,诡异的事情出现了

[root@localhost ~]# service php-fpm start
Starting php-fpm: [18-Nov-2015 22:41:44] ERROR: unable to bind listening socket for address '127.0.0.1:9001': Permission denied (13)
[18-Nov-2015 22:41:44] ERROR: FPM initialization failed
[FAILED]

明明是root用户,明明9001端口没被占用,怎么会没有权限?百思不得其解
原因竟然是Centos内核中启用了SELinux

[root@localhost ~]# cat /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
#SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

将SELINUX=enforcing改为SELINUX=disabled并重启系统 就可以了
何为SELinux?什么时候需要启用SELinux,什么时候不启用?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: