我在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>
我更改了apacheports.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,它就不起作用我也没有看到任何有用的错误消息。
您的域证书对localhost无效,因此Nginx将拒绝它。无论如何,连接到localhost时都不需要SSL,所以只需将Nginx的HTTPS侦听器代理到Apache的HTTP侦听器即可。