Ubuntu 18.04+OpenLiteSpeed环境下SOAP调用WebService时端口8051连接被拒问题排查求助
Ubuntu 18.04+OpenLiteSpeed环境下SOAP调用WebService时端口8051连接被拒问题排查求助
大家好,我目前在Ubuntu 18.04服务器上部署了OpenLiteSpeed,最近写了一段PHP代码通过SOAP调用某个Web服务,这段代码在本地测试环境完全正常,但放到生产服务器上就出问题了,想请大家帮忙排查下。
我的SOAP代码如下:
$soapParams = array( 'login' => 'Name', 'password' => 'password', 'authentication' => SOAP_AUTHENTICATION_BASIC, 'trace' => 1, 'exceptions' => 1, ); $params = array(); $client = new SoapClient('https://myserver.name:8051/MEX?wsdl', $soapParams); $params = array( 'DataServerName' => 'NAME', 'PrimaryKey'=>'KEYNAME', ); $result = $client->ReadRecord($params); echo "response:\n" . $client->__getLastResponse() . "<br><br>";
生产服务器返回的错误:
Exceção - SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://myserver.name:8051/MEX?wsdl' : failed to load external entity "https://myserver.name:8051/MEX?wsdl"
我做的排查步骤:
- curl测试对比:本地服务器curl该WSDL地址能正常响应,但生产服务器执行
curl https://myserver.name:8051/MEX?wsdl返回:curl: (7) Failed to connect to myserver.name port 8051: Connection refused - 检查hosts文件:生产服务器的
/etc/hosts内容如下:127.0.0.1 localhost servermyserver ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters - 端口监听检查:
- 执行
netstat -ln | grep 443和netstat -ln | grep 80,能看到80、443等端口正常监听(输出内容如下):root@servermyserver:/etc# netstat -ln | grep 443 tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN tcp6 0 0 :::443 :::* LISTEN tcp6 0 0 :::443 :::* LISTEN tcp6 0 0 :::443 :::* LISTEN tcp6 0 0 :::443 :::* LISTEN udp 0 0 0.0.0.0:443 0.0.0.0:* udp 0 0 0.0.0.0:443 0.0.0.0:* udp 0 0 0.0.0.0:443 0.0.0.0:* udp 0 0 0.0.0.0:443 0.0.0.0:* udp6 0 0 :::443 :::* udp6 0 0 :::443 :::* udp6 0 0 :::443 :::* udp6 0 0 :::443 :::*root@servermyserver:/etc# netstat -ln | grep 80 tcp 0 0 0.0.0.0:7080 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN udp 0 0 0.0.0.0:7080 0.0.0.0:* unix 2 [ ACC ] STREAM LISTENING 2307434806 /usr/local/lsws/admin/tmp/admin.sock.7958 unix 2 [ ACC ] STREAM LISTENING 2308072711 /tmp/lshttpd/facsu7698.sock - 但执行
netstat -ln | grep 8051时没有任何输出,说明服务器根本没监听8051端口。
- 执行
- 强制IPv4测试:执行
curl --ipv4 -v "https://myserver.name:8051/MEX?wsdl",结果还是连接被拒:* Trying xxx.xxx.xxx.xxx... * TCP_NODELAY set * connect to xxx.xxx.xxx.xxx port 8051 failed: Connection refused * Failed to connect to myserver.name:8051 port 8051: Connection refused * Closing connection 0 curl: (7) Failed to connect to myserver.name:8051 port 8051: Connection refused - telnet测试:
- 执行
telnet localhost 8051返回telnet: Unable to connect to remote host: Connection refused - 但执行
telnet localhost 80能正常连接。
- 执行
现在我有点摸不着头绪了,本地环境一切正常,生产环境就是连不上8051端口,想问问大家有没有什么排查方向或者解决办法?
备注:内容来源于stack exchange,提问作者user1012130
相关产品推荐
相关产品推荐

