nginx配置ssl证书实现https访问分析

你猜 阅读:143 2020-06-30 16:13:13 评论:0

1、nginx.conf配置文件

server { 
        listen       80; 
        server_name www.abc.lynch.com abc.lynch.com; 
        error_log   /usr/share/nginx/html/test/pay_local.error; 
          client_max_body_size 60M; 
        client_body_buffer_size 512k; 
        location / {    
            root   /usr/share/nginx/html/kshop; 
            index  index.html; 
            autoindex  on; 
        } 
       # rewrite ^(.*) https://$server_name$1 permanent;  
} 
server { 
    listen       443    ssl; 
    server_name www.abc.lynch.com abc.lynch.com; 
        error_log   /usr/share/nginx/html/test/pay_local.error; 
              client_max_body_size 60M; 
        client_body_buffer_size 512k; 
        location / { 
                root   /usr/share/nginx/html/kshop; 
                index  index.html; 
                autoindex  on; 
        } 
    ssl_certificate /etc/nginx/conf.d/fullchain.pem; #证书位置 
    ssl_certificate_key /etc/nginx/conf.d/privkey.pem; #私钥位置 
}

 

server { 
    listen       443    ssl; 
    server_name www.erpshopmobilexmjservertest.xinyartech.com erpshopmobilexmjservertest.xinyartech.com; 
    error_log   /usr/share/nginx/html/test/pay_local.error; 
    client_max_body_size 60M; 
    client_body_buffer_size 512k; 
    location / { 
        proxy_pass   http://172.16.92.254:8062; 
    } 
    ssl_certificate /etc/nginx/conf.d/fullchain.pem; 
    ssl_certificate_key /etc/nginx/conf.d/privkey.pem; 
}

 

2、启动nginx,映射443端口

docker run --restart=always --name nginx_erp_test -d -p 80:80 -p 443:443 -v /www/html/attachment:/www/html/attachment -v /data/nginx/html:/usr/share/nginx/html -v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf  -v /data/nginx/logs:/var/log/nginx -v /data/nginx/conf.d:/etc/nginx/conf.d nginx

 

标签:nginx
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
搜索
关注我们

扫一扫关注我们,了解最新精彩内容