首页 / 服务中心 / 常见问题

Jpush推送消息出现502 Bad Gateway错误的解决方法

时间:2016-08-03 16:09:23 点击:

易客CRM手机版新版本的推送消息方案现在使用的是JPush的推送方案,推送消息更稳定.本地客户和阿里云的云服务器上都正常运行,上周一家做私有云的上市公司客户遇到了奇怪问题,crm系统中经常发现502错误,经检查是和推送消息有关系.百度502的解决方法,找到2种解决方法:

第一种方法:将unix套接字改成tcp/ip

/usr/local/php/etc/php-fpm.cnf

< value name=”“listen_address””>/tmp/nginx.socket< /value>

里面的

/tmp/nginx.socket

修改成

127.0.0.1:9000

同时将/usr/local/nginx/conf/nginx.conf 及其/usr/local/nginx/conf/vhost/ 下面的虚拟主机配置里的

fastcgi_pass  unix:/tmp/php-cgi.sock;

修改成

fastcgi_pass  127.0.0.1:9000;

之后,重新启动LNMP。

这种方法可以解决wodpress部分后台的502错误问题,但不能解决易客CRM的502 Bad Gateway错误。

第二种方法,将libsqlite3.so.0.8.6停用

32位的修改如下

mv /usr/lib/libsqlite3.so.0.8.6 /usr/lib/libsqlite3.so.0.8.6.bak

64位的修改如下

mv /usr/lib64/libsqlite3.so.0.8.6 /usr/lib64/libsqlite3.so.0.8.6.bak

修改完重新启动lnmp,易客CRM就不出现502 Bad Gateway错误了。

但是推送消息却不出去,经过精简代码,发现是PHP调用curl导致的502错误,而且linux操作系统很多地方还需要使用sqlite,例如yum需要sqlite,curl命令相关的证书也要用sqlite,操作系统的sqlite不能停用.尝试编译php,把php中的sqlite禁用掉, PHP5.2.17的编译脚本和参数如下,尤其是sqlite相关的参数至关重要

./buildconf --force 

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic --without-sqlite --without-pdo-sqlite

make ZEND_EXTRA_LIBS='-liconv' 

make install

编译成功后,重启lnmp,发现推送消息正常,crm系统的功能也都正常.非常不错,有点遗憾,php中不能使用sqlite,不过CRM不使用sqlite也就没关系了.