nginx同时使用(http)80和(https)443端口

server {
        listen       443 ssl; #监听https 443时需加ssl
        server_name  ; #你的域名

        ssl on;
        ssl_certificate  ; #证书路径
        ssl_certificate_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;

        include /etc/nginx/default.d/*.conf;

        location / {
            proxy_pass http://127.0.0.1:8080; #代理地址
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

    server {
        listen       80;
        server_name  ; #你的域名

        include /etc/nginx/default.d/*.conf;

        location / {
            proxy_pass http://127.0.0.1:8081; #代理地址
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

 

你可能感兴趣的:(nginx同时使用(http)80和(https)443端口)