效果:

nginx添加ssl模块

./configure  --with-http_ssl_module

生成证书

openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 1096 -key ca.key -out ca.crt

配置文件

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65; server {
listen 80;
server_name localhost; location / {
root html;
index index.html index.htm;
return 301 https://$server_name$request_uri;
} } # HTTPS server server {
listen 443 ssl;
server_name localhost; ssl_certificate ca/ca.crt;
ssl_certificate_key ca/ca.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;
}
} }

启动

./sbin/nginx -c conf/ca.conf

nginx使用https协议的更多相关文章

  1. 【转】Linux下nginx配置https协议访问的方法

    一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...

  2. Linux下nginx配置https协议访问

    一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...

  3. Linux下nginx配置https协议访问的方法

    一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...

  4. nginx 采用https 协议通信配置

    在网络通信中,使用抓包软件可以对网络请求进行分析,并进行重放攻击,重放攻击的解决方案一般是使用一个变化的参数,例如RSA加密的时间戳,但考虑到网络传输时延,时间戳需要有一定的误差容限,这样仍然不能从根 ...

  5. nginx 使用HTTPS协议-SSL证书模块报错解决-附nginx安装 : [emerg] the "ssl" parameter requires ngx_http_ssl_module in nginx.c

    Linux系统下ngnix使用HTTPS协议启动报错: nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_modul ...

  6. 阿里云服务器Centos7上使用Nginx部署https协议的网站

    1,申请域名证书成功后,下载压缩包,一定要选择Nginx的证书类型,解压后得到一个key文件一个pem文件,将这两个文件上传到服务器的root目录 2,打开nginx配置文件 vim /etc/ngi ...

  7. Centos下nginx支持https协议

    1.首先配置nginx及其他插件,这个Google下,很多配置方案. 2.配置服务器的证书.操作步骤如下: [root@localhost ~]# cd /etc/pki/tls/certs [roo ...

  8. Linux服务之nginx服务篇四(配置https协议访问)

    一.配置nginx支持https协议访问 编译安装nginx的时候需要添加相应的模块--with-http_ssl_module和--with-http_gzip_static_module(可通过/ ...

  9. CentOS6.5 下在Nginx中添加SSL证书以支持HTTPS协议访问

    参考文献: 1. NginxV1.8.0安装与配置 2. CentOS下在Nginx中添加SSL证书以支持HTTPS协议访问 3. nginx配置ssl证书的方法 4.nginx强制使用https访问 ...

随机推荐

  1. mysql体系结构和sql查询执行过程简析

    一: mysql体系结构 1)Connectors 不同语言与 SQL 的交互 2)Management Serveices & Utilities 系统管理和控制工具 备份和恢复的安全性,复 ...

  2. Linux里的eval命令

      这个命令之前没有用过,在网上查了一下资料,觉得人家写的很好,所以复制过来了. 标题:linux命令eval的用法 链接:http://blog.chinaunix.net/uid-21411227 ...

  3. ajax传值修改数据

    主界面代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. ...

  4. Mac 软件专题之:OS X Yosemite 精彩应用软件推荐

    目前,很多软件都已经发布了针对Yosemite系统的版本,今天和大家分享专题:「OS X Yosemite 精彩应用」,主要分享适配Yosemite系统全新的扁平化界面和新功能的软件,但要知道未在此专 ...

  5. 解决openoffice进程异常退出的办法

    步骤1 编写脚本 openoffice.sh #!/usr/bin/bash OPENOFFICEPID=`ps -ef|grep "/opt/openoffice4/program/sof ...

  6. 【JS】JS格式化文件大小 单位:Bytes、KB、MB、GB

    输入一个表示文件大小的数字,自适应转换到KB,MB,GB 方法一:bytes自适应转换到KB,MB,GB /// <summary> /// 格式化文件大小的JS方法 /// </s ...

  7. zk创建集群

    在单机环境下和创建集群. 需要注意的点: 配置数据文件myid 1/2/3 对应server.1/2/3 通过./zkCli.sh -server [ip]:[port]  检测集群是否创建成功 在z ...

  8. jackson工具类 对象转字符串 -- 字符串转对象

    这个一个json的工具类.用的是jackson,当然还有谷歌的gosn,阿里的fastjson ,但是jackson的感觉还是最成熟(网上大神说的...) 实现的功能很简单,对象转字符串  字符串转简 ...

  9. Jpush极光推送

    require 'jpush' class SidkiqJpushWorker include Sidekiq::Worker # args[0] msg : args[1] region_id ; ...

  10. UVALive - 7041 The Problem to Slow Down You (回文树)

    https://vjudge.net/problem/UVALive-7041 题意 给出两个仅包含小写字符的字符串 A 和 B : 求:对于 A 中的每个回文子串,B 中和该子串相同的子串个数的总和 ...