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

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

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

  1. [root@localhost ~]# service php-fpm start

  2. 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)

  3. [18-Nov-2015 22:41:44] ERROR: FPM initialization failed

  4. [FAILED]


明明是root用户,明明9001端口没被占用,怎么会没有权限?百思不得其解

原因竟然是Centos内核中启用了SELinux

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

  2.  
  3. # This file controls the state of SELinux on the system.

  4. # SELINUX= can take one of these three values:

  5. # enforcing - SELinux security policy is enforced.

  6. # permissive - SELinux prints warnings instead of enforcing.

  7. # disabled - No SELinux policy is loaded.

  8. SELINUX=enforcing

  9. #SELINUX=disabled

  10. # SELINUXTYPE= can take one of these two values:

  11. # targeted - Targeted processes are protected,

  12. # mls - Multi Level Security protection.

  13. SELINUXTYPE=targeted


将SELINUX=enforcing改为SELINUX=disabled并重启系统 就可以了

原文:https://blog.csdn.net/yesuhuangsi/article/details/49914231

发布了44 篇原创文章 · 获赞 28 · 访问量 42万+

猜你喜欢

转载自blog.csdn.net/hanzengyi/article/details/82108508