2016-03-28 106 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