【问题标题】:php soap api call over https not working通过https的php soap api调用不起作用
【发布时间】:2016-03-28 15:03:23
【问题描述】:

我在 debian 上设置了一个 php soap 服务器 api,并使用 nginx 作为 apache 的代理。 Soap 调用在 http 上可以正常工作,但在 https 上不行

nginx配置如下

server {

   listen 443 ssl;
   server_name <sub domain name>;

   ssl on;
   ssl_certificate /etc/nginx/ssl/dev/wildcard.<dm name>-chained.crt;
   ssl_certificate_key /etc/nginx/ssl/dev/wildcard.<dm name>.key;

   location / {
    proxy_redirect off;
    proxy_pass https://localhost:8081;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }

}
  server {
  listen 80;
  # return 301 https://$host$request_uri;
  server_name <sub domain name>;
  location / {
     proxy_pass http://<server ip>:8080;
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto $scheme;
  }
}

和apache的配置如下

   <VirtualHost *:8081>
    ServerName <my sub domain>
    ServerAlias www.<my sub domain>


    SSLEngine on
    SSLCertificateFile    /etc/nginx/ssl/dev/wildcard.<dm name>-chained.crt
    SSLCertificateKeyFile /etc/nginx/ssl/dev/wildcard.<dm name>.net.key

    #SSLProtocol ALL -SSLv2 -SSLv3
    #SSLVerifyClient none
    #SSLVerifyDepth 1
    #SSLHonorCipherOrder On

   #SSLCipherSuite    

   DocumentRoot /var/www/<project folder>
   <Directory /var/www/<project folder>>
      Options FollowSymLinks -Indexes
      AllowOverride All
      Order Allow,Deny
      Allow from all
      SSLRequireSSL
  </Directory>
</VirtualHost>

我已将 apache ports.conf 更改如下

  NameVirtualHost *:8080
  Listen 8080

<IfModule mod_ssl.c>
  NameVirtualHost *:8081
  #    # If you add NameVirtualHost *:443 here, you will also have to change
  #    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
  #    # to <VirtualHost *:443>
  #    # Server Name Indication for SSL named virtual hosts is currently not
  #    # supported by MSIE on Windows XP.
  Listen 8081
 </IfModule>

<IfModule mod_gnutls.c>
   Listen 8081
</IfModule>

请告知我在这里错过了什么。 当我在本地使用php客户端并进行soap调用时,如果url是http,它可以工作,但如果url是https,它就不起作用 我也没有看到任何有用的错误消息。

【问题讨论】:

    标签: php apache web-services soap nginx


    【解决方案1】:

    您的域证书对 localhost 无效,因此 Nginx 将拒绝它。无论如何连接到 localhost 时都不需要 SSL,因此只需将 Nginx 代理的 HTTPS 侦听器设置为 Apache 的 HTTP 侦听器即可。

    【讨论】:

    • 谢谢。我做了那个改变它仍然不起作用。我将 nginx HTTPS 侦听器配置更改为 proxy_pass http://:8080;我可以使用我的浏览器通过 https 毫无问题地访问肥皂文件,但简单的 php soap 客户端调用不起作用 $vLocation = 'https://'; $client = new SoapClient("",array("location" => $vLocation, "trace"=>1,'cache_wsdl' => WSDL_CACHE_NONE )); $vFunctions = $client->__getFunctions();相同的 php soap 应用程序托管在我无权访问 vhost 配置工作的不同服务器上
    • 当我做 openssl s_client -connect <443>
    猜你喜欢
    • 2014-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-02
    • 2017-09-08
    • 2016-08-11
    • 2012-12-25
    相关资源
    最近更新 更多