nginx配置http和https

来源:互联网 发布:时间序列数据举例来源 编辑:程序博客网 时间:2024/05/29 17:16

  upstream test{

        server localhost:xxxx weight=1;

    }



server{    

                 listen  80;

                  listen 443 ssl;

                 server_name xxxxxxx;

                 keepalive_timeout   70;

                ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;

                ssl_ciphers        AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;

              ssl_certificate     /xxxx/server.crt;

               ssl_certificate_key / xxxxxx/server_no.key;

              ssl_session_cache   shared:SSL:10m;

             ssl_session_timeout 10m;

            if ($request_method !~* GET|POST) {

                 return 405;

 

                 }

      

        location / {

            proxy_pass  https://test;

            proxy_set_header        Host            $host;

            proxy_set_header        X-Real-IP       $remote_addr;

            proxy_set_header        X-Forwarded-For$proxy_add_x_forwarded_for;

        }

 


原创粉丝点击