效果:

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. (数学 尾0的个数) 51nod1003 阶乘后面0的数量

    n的阶乘后面有多少个0? 6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0. 收起   输入 一个数N(1 <= N <= 10^9) 输出 输出0的数量 输入样例 5 ...

  2. go的net/rpc用法

    一:PRC是什么? RPC(Remote Procedure Call) 远程过程调用,是一个计算通信协议.该协议允许一台计算机上的程序调用另外一台计算机上的程序.远程过程调用就是2个不在同一台计算机 ...

  3. nginx变量(日志log_format)

    nginx变量(日志log_format) HTTP请求变量 - arg_PARAMETER.http_HEADER.sent_http_HEADER 它是指http请求中的变量,举例: curl访问 ...

  4. 2017-12-15python全栈9期第二天第七节之数字转换成布尔值

    #!/user/bin/python# -*- coding:utf-8 -*-print(bool(2))

  5. Java Web之上传文件

    本篇文章你会学到 1. Apache FileUpload组件 2.上传文件保存的路径和名称问题 3.缓存大小和临时目录 4.控制文件上传的格式 先讲一个简单的例子,一个注册页面,有账号,邮箱,和头像 ...

  6. ubuntu 14.04中安装 ruby on rails 环境

    环境:在win7 上Vmware虚拟机环境中安装的ubuntu 14.04 1. bundle install 时,报json错误可以看出是在安装nokogiri时遇到了问题,此时执行 sudo ap ...

  7. bzoj千题计划321:bzoj5251: [2018多省省队联测]劈配(网络流 + 二分)

    https://www.lydsy.com/JudgeOnline/problem.php?id=5251 第一问: 左边一列点代表学生,右边一列点代表导师 导师向汇点连流量为 人数限制的 边 然后从 ...

  8. bzoj千题计划318:bzoj1396: 识别子串(后缀自动机 + 线段树)

    https://www.lydsy.com/JudgeOnline/problem.php?id=1396 后缀自动机的parent树上,如果不是叶子节点,那么至少有两个子节点 而一个状态所代表子串的 ...

  9. 905. Sort Array By Parity

    Description Given an array A of non-negative integers, return an array consisting of all the even el ...

  10. AAndroid Studio的\drawable还是mipmap

    图片应该放在drawable文件夹下,而mipmap文件夹只适合放app icons