赞
踩
Nginx代理https接口,附上Nginx配置文件,详情见注释。
server {
listen 443 ssl;
server_name api.xxx.com;
access_log /root/logs/index.access.log main;
error_log /root/logs/index.error.log;
root /;
index index.html index.htm index.php;
ssl_certificate cert/xxx.pem; #将domain name.pem替换成您证书的文件名。
ssl_certificate_key cert/xxx.key; #将domain name.key替换成您证书的密钥文件名。
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。
ssl_prefer_server_ciphers on;
## send request back to apache ##
location / {
#Proxy Settings
# 接口的本地地址 反向代理
proxy_pass http://localhost:50005;
proxy_redirect off;
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_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。