2016-03-28 113 views
1

我有一个PHP肥皂服务器API设置Debian与Nginx作为代理到Apache。 SOAP调用在工作正常的HTTP而不是通过httpsphp肥皂API调用通过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客户端,并使肥皂调用它的作品,如果url是http,但不工作,如果url是https 我也没有看到任何有用的错误消息。

回答

0

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

+0

谢谢。我做了改变它仍然不起作用。 我将nginx HTTPS监听器conf更改为 proxy_pass http:// <我的服务器ip>:8080; 我可以使用我的浏览器通过https访问肥皂文件没有问题 ,但简单的PHP肥皂客户端调用不起作用 $ vLocation ='https:// '; $ client = new SoapClient(“”,array( “location”=> $ vLocation, “trace”=> 1,'cache_wsdl'=> WSDL_CACHE_NONE )); $ vFunctions = $ client - > __ getFunctions(); 同PHP SOAP应用程序托管在不同的服务器在那里我没有访问虚拟主机配置上工作 – manoveg

+0

当我做 的OpenSSL的s_client.First -connect -ssl3 我得到 '连( 00000003) 140735331525456:错误:1409E0E5:SSL例程:SSL3_WRITE_BYTES:SSL握手失败:s3_pkt.c:598:' 我在nginx的配置 ssl_protocols的SSLv3的TLSv1 TLSv1.1 TLSv1.2工作如下; 任何想法 – manoveg