美文网首页
nginx配置https

nginx配置https

作者: 醉于麦田 | 来源:发表于2018-03-23 11:54 被阅读0次

nginx配置https

https需要的证书我们已经申请到了,下面分享下nginx配置https的一些配置参数!

这是我的配置

========================================================================

server {

listen 443 ssl;

    ssl on;

    ssl_certificate /etc/letsencrypt/live/zhanj163.com/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/zhanj163.com/privkey.pem;

    server_name  go.zhanj163.com;

    root /alidata/www/go_workspace/src/go_zhanj163;

    index index.html index.htm;

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf) {

            expires      30d;

    }

    location ~ .*\.(js|css)? {

            expires      12h;

    }

    location /(css|js|fonts|img)/ {

        access_log off;

        expires 1d;

        root "/alidata/www/go_workspace/src/go_zhanj163";

        try_files $uri @backend;

    }

    location / {

        try_files /_not_exists_ @backend;

    }

    location @backend {

        proxy_pass_header Server;

        proxy_set_header X-Forwarded-For $remote_addr;

        proxy_set_header Host            $http_host;

        proxy_redirect off;

        proxy_pass http://127.0.0.1:8080;

    } 

    access_log  /alidata/log/nginx/access/go.zhanj163.com;

}

===================================================================

如果想启用https同时也想启用http,我们可以这样配置

配置文件基本不用怎么修改!

nginx强制使用https

为了数据安全,我们可以设置强制使用https!

我配置的相对简单,不影响使用,就是一个指向配置!

https://www.linuxidc.com/Linux/2017-12/149764.htm

https://github.com/certbot/certbot

相关文章

  • # nginx https证书配置

    nginx https证书配置 一 前言 此文档针对于nginx配置反向代理使用https证书方法 nginx作为...

  • nginx https 配置

    nginx https 配置

  • nginx配置https

    nginx配置https https需要的证书我们已经申请到了,下面分享下nginx配置https的一些配置参数!...

  • Nginx配置https请求,以及Nginx+keepalive

    一、Nginx配置https请求 要实现Nginx配置https请求,安装的时候需要加上 --with-http_...

  • nginx配置https

    只配置443会导致http和https共存,只要再80里配置个重定向即可return 301 https://$s...

  • nginx https配置

    本地文件上传到服务器

  • Nginx https 配置

    准备环境阿里云 腾讯云部署好站点,且使用DNS解析到云服务器的IP地址 接下来就是配置HTTPS的关键步...

  • Nginx配置HTTPS

  • Nginx 配置 https

    从云服务提供商处申请证书 申请 https 证书教程-百度经验 申请下来的证书目录结构 下文中只拿 Nginx 来...

  • NGINX 配置 HTTPS

    首先是下载证书,我的是再阿里云里面,如果购买成功了,直接下载证书。里面会有两后缀分别为.key和.pem的个文件,...

网友评论

      本文标题:nginx配置https

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