zoukankan      html  css  js  c++  java
  • Nginx+Https自己敲命令生成证书

    nginx配置https访问

    一、准备

          环境:centos6.8

          nginx:1.13.6

    二、开始

          首先安装依赖包:

           yum install -y gcc gcc-c++ autoconf automake make zlib zlib-devel openssl openssl-devel pcre pcre-devel

          开始安装

          tar -xf nginx-1.13.6.tar.gz

          cd nginx-1.13.6

          ./configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module

          make && make install 

    三、配置https签名证书

      创建https证书存放目录:mkdir cert

          创建私钥:openssl genrsa -des3 -out https.key 1024

          创建签名请求证书:openssl req -new -key https.key -out https.csr

          在加载SSL支持的Nginx并使用上述私钥时除去必须的口令:

      cp https.key https.key.org

      openssl rsa -in https.key.org -out https.key

      最后标记证书使用上述私钥和CSR和有效期:openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt

    四、配置nginx的https

      配置vim nginx.conf

       

     server {

            listen       443 ssl;

            server_name  192.168.2.90;

            ssl_certificate      /usr/local/nginx/cert/https.crt;

            ssl_certificate_key  /usr/local/nginx/cert/https.key;

           #    ssl_session_cache    shared:SSL:1m;

            ssl_session_timeout  5m;

          #    ssl_ciphers  HIGH:!aNULL:!MD5;

        #    ssl_prefer_server_ciphers  on;

        location / {

                         root   html;

                index  index.html index.htm;

            }

        }

    五、完成


    启动nginx  :/usr/local/nginx/sbin/nginx

    有问题改配置后平滑重启nginx:/usr/local/nginx/sbin/nginx -s reload

    用浏览器访问:https://ip

    注意:自己创建的证书浏览器会提示危险,选择通过就可以了。

  • 相关阅读:
    在Windows 10 64位上编译DCMTK
    python递归解决汉诺塔
    python迭代和递归实现斐波那契
    20199302 2019-2020-2 《网络攻防实践》第4周作业
    ssh爆破
    20199302 2019-2020-2 《网络攻防实践》第3周作业
    字符串模版替换的方法MessageFormat.format(String pattern, Object ... arguments)
    Java并发编程之LinkedBlockingDeque阻塞队列详解
    理解Spring容器、BeanFactory和ApplicationContext
    Steam之两个list间交集、并集、差集
  • 原文地址:https://www.cnblogs.com/muliu/p/9482728.html
Copyright © 2011-2022 走看看