美文网首页
nginx配置

nginx配置

作者: talent_ray | 来源:发表于2020-03-23 10:14 被阅读0次

    1.正常只需要修改conf中server即可实现代理功能
    server {
    listen 80; #监听端口
    server_name: localhost;
    root /home; #访问目录
    index index.html index.htm;
    location / { #根目录默认跳转
    index index.html index.htm;
    }
    }
    2.添加ssl
    server {
    listen 443;
    server_name www.baidu.com; #域名
    root /home;
    index index.html index.htm;
    ssl on;#开启ssl
    ssl_certificate 1_www.baidu.com_bundle.crt; #配置ssl证书
    ssl_certificate_key 2_www.baidu.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 / {
    index index.html index.htm;
    }
    }
    若想支持默认http转https,可进行添加如下配置
    server {
    listen 80;
    server_name www.baidu.com;
    #http强制跳转https
    rewrite ^(.*)https://host$request_uri permanent;
    }

    1. 添加负载均衡

    相关文章

      网友评论

          本文标题:nginx配置

          本文链接:https://www.haomeiwen.com/subject/ucmiyhtx.html