nginx中server下同时配置http和https样例

server {
    listen 80;
    listen 443 ssl;
    server_name www.qclog.cn;
    server_name qclog.cn;
    ssl_certificate /app/blog/ssl/7853372_www.qclog.cn.pem;
    ssl_certificate_key /app/blog/ssl/7853372_www.qclog.cn.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    location / {
        proxy_pass http://blog;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_connect_timeout 1;
    }
    location /status {
        check_status;
        access_log off;
    }
}

相关文章:使用nginx安装部署ssl证书实现https


觉得内容还不错?打赏个钢镚鼓励鼓励!!👍