zoukankan      html  css  js  c++  java
  • Nginx 配置为https服务器

    本机作为https服务器

     1 server {
     2        listen       444 ssl;
     3         server_name  localhost;
     4 
     5         ssl_certificate      ssl/server.crt;
     6        ssl_certificate_key  ssl/server.key;
     7      ssl                  on;
     8         ssl_session_cache    shared:SSL:1m;
     9        ssl_session_timeout  5m;
    10 
    11     #    ssl_ciphers  HIGH:!aNULL:!MD5;
    12         ssl_prefer_server_ciphers  on;
    13 
    14         location / {
    15             root   html;
    16             index  index.html index.htm;
    17         }
    18     }
    View Code

    https转发到其他机器的http端口

     1   # HTTPS server
     2     #
     3     server {
     4        listen       444 ssl;
     5         server_name  localhost;
     6 
     7         ssl_certificate      ssl/server.crt;
     8        ssl_certificate_key  ssl/server.key;
     9        ssl                  on;
    10         ssl_session_cache    shared:SSL:1m;
    11        ssl_session_timeout  5m;
    12 
    13     #    ssl_ciphers  HIGH:!aNULL:!MD5;
    14        # ssl_prefer_server_ciphers  on;
    15 
    16         location / {
    17             #root   html;
    18             #index  index.html index.htm;
    19              proxy_redirect off;
    20      proxy_set_header Host $host;
    21      proxy_set_header X-Real-IP $remote_addr;
    22      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    23      proxy_pass http://192.168.0.105/;
    24         }
    25     }
    View Code

    80端口强制跳转https

    1     server {  
    2         listen  192.168.1.111:80;  
    3         server_name test.com;  
    4           
    5         rewrite ^(.*)$  https://$host$1 permanent;  
    6     }  
    View Code
  • 相关阅读:
    7、猜年龄
    6、continue语句
    5、break语句
    4、while循环练习
    poj 2378
    poj 2342
    poj 2287
    poj 2228
    poj 1191
    srm 578 dv2 1000pt
  • 原文地址:https://www.cnblogs.com/weiweictgu/p/6581617.html
Copyright © 2011-2022 走看看