打印

安装lnmpa 是出现nginx 502 Bad Gateway错误的一个解决办法

安装lnmpa 是出现nginx 502 Bad Gateway错误的一个解决办法

今天在虚拟机上安装了centos 5.6 测试lampa 0.7,一切顺利,
最后一步重新启动apache报如下错误:
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied



解决办法:
原因是Linux有一个SELinux保护模式引起的。
1关闭SELINUX的方法:
vi /etc/selinux/config 将SELINUX=enforcing 改成SELINUX=disabled  需要重启

2不关闭SELINUX的方法:
# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libphp5.so
# service httpd restart
# setenforce 1

TOP

设置了

[root@AY130306101818270a4b ~]# /root/lnmpa restart
=========================================================================
Manager for LNMPA V0.9  ,  Written by Licess
=========================================================================
LNMPA is a tool to auto-compile & install Nginx+MySQL+PHP+Apache on Linux
This script is a tool to Manage status of LNMPA
For more information please visit http://www.lnmp.org


Usage: /root/lnmpa {start|stop|reload|restart|kill|status}
=========================================================================
Stoping LNMP...
Nginx program is stop
httpd: Syntax error on line 343 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot open shared object file: No such file or directory
MySQL program is not runing!
Starting LNMPA...
Nginx start successfully!
httpd: Syntax error on line 343 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot open shared object file: No such file or directory
Starting MySQL SUCCESS!
MySQL start successfully!


安装教程上面的两种设置了,还是502,也重启过服务器了
该怎么解决呢

TOP

找到问题了 我升级到php5.4  /usr/local/php/里面就会只有一个文件夹     现在升级到5.3.6就正常了

TOP