nginx https代理http配置

2240阅读 0评论2017-09-05 月歌54
分类:系统运维

一、应用场景

浏览器到nginx是https,https代理后端http。

配置如下:

点击(此处)折叠或打开

  1. server {
  2.         listen 443 ssl;
  3.         server_name enca.ulifecam.com;

  4.         ssl_certificate /srv/nginx/conf/ssl/cert.pem;
  5.         ssl_certificate_key /srv/nginx/conf/ssl/cert;
  6.         ssl_session_cache shared:SSL:1m;
  7.         ssl_session_timeout 5m;
  8.         ssl_ciphers HIGH:!aNULL:!MD5;
  9.         ssl_prefer_server_ciphers on;
  10.         location / {
  11.                 proxy_redirect http:// $scheme://;
  12.                 proxy_set_header Host $host;
  13.                 proxy_set_header X-Real-IP $remote_addr;
  14.                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  15.                 proxy_set_header X-Forwarded-Proto $scheme;
  16.                 proxy_pass http://127.0.0.1:9090;
  17.         }

  18. }

上一篇:Linux 命令之 shopt
下一篇:shell 常见错误解决办法