zoukankan      html  css  js  c++  java
  • nginx配置文件 http 强跳转 https

    路径 /usr/local/nginx/conf/conf.d/test.jackcui.com.conf

    server {
        listen 80;
        server_name  test.jackcui.com;
        rewrite ^(.*)$ https://${server_name}$1 permanent;
    }
    
    server {
     listen 443 ssl;
     server_name test.jackcui.com;
     access_log   /data2/log/nginx/test.jackcui.com_access.log;
     error_log   /data2/log/nginx/test.jackcui.com_error.log;
    
     ssl_certificate   cert/2351572__jackcui.com.pem;
     ssl_certificate_key  cert/2351572__jackcui.com.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;
    
    location / {
        proxy_pass http://10.0.0.1:8080;
        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 $remote_addr;
        proxy_connect_timeout 600;
        proxy_read_timeout 600;
        proxy_send_timeout 600;
        client_max_body_size 1024M; # Set higher depending on your needs
    }
    
    }
    

    路径 /usr/local/nginx/conf/nginx.conf

    user  nginx;
    worker_processes  2;
    
    events {
        use epoll;
        worker_connections  102400;
    }
    
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        #gzip  on;
    
        server {
            listen       80;
            server_name  default_server;
    
            location / {
                root   /data1/web/default;
                index  index.html index.htm;
            }
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    
        }
        include conf.d/*.conf;
    
        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    
        # HTTPS server
        #
        #server {
        #    listen       443 ssl;
        #    server_name  localhost;
    
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;
    
        #    ssl_session_cache    shared:SSL:1m;
        #    ssl_session_timeout  5m;
    
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers  on;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    }

     

     

  • 相关阅读:
    Vitamio中文API文档(3)—— MediaController
    [活动]hhhchina.net很暴力,还有更好的投票方式吗?
    [anytao.activity]也来拉票,不只为评选
    [活动]Scott,来了
    写在2007,行胜于言
    《你必须知道的.NET》,评价和推荐
    [你必须知道的.NET]第十七回:貌合神离:覆写和重载
    [你必须知道的.NET]第十八回:对象创建始末(上)
    当选2008 Microsoft MVP,从好的开始继续
    [你必须知道的.NET]第十九回:对象创建始末(下)
  • 原文地址:https://www.cnblogs.com/jackcui/p/11642650.html
Copyright © 2011-2022 走看看