zoukankan      html  css  js  c++  java
  • Nginx核心知识100讲学习笔记(陶辉):初始Nginx(三)

    一、SSL 证书的公信力是如何保证的?

    1、证书类型

    2、证书链

     

    二、SSL 协议握手时 Nginx 的性能瓶颈在哪里?

    1、TLS通讯过程

    2、nginx握手性能

    3、nginx数据加密性能

    4、nginx综合性能

    三、用免费 SSL 证书实现一个 HTTPS 站点

    1、安装

    [root@luoahong conf]# yum install certbot python2-certbot-nginx -y

    2、配置

    [root@luoahong conf]# certbot --nginx --nginx-server-root=/usr/local/openresty/nginx/conf/ -d www.luoahong.com
    ......

    3、nginx配置

    增加如下配置

        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/pazzn.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/pazzn.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    四、基于 OpenResty 用 Lua 语言实现简单服务

    1、下载OpenResty

    [root@luoahong src]# wget https://openresty.org/download/openresty-1.13.6.2.tar.gz

    2、分析目录结构

    1、比nginx看起来少了很多东西,少的的东西到底在哪?

    [root@luoahong openresty-1.13.6.2]# ll
    total 108
    drwxrwxr-x. 43 1000 1000 4096 May 15 2018 bundle #少的东西在这
    -rwxrwxr-x. 1 1000 1000 48140 May 15 2018 configure
    -rw-rw-r--. 1 1000 1000 22924 May 15 2018 COPYRIGHT
    -rw-r--r--. 1 root root 5572 Mar 1 09:02 Makefile
    drwxrwxr-x. 2 1000 1000 156 May 15 2018 patches
    -rw-rw-r--. 1 1000 1000 4689 May 15 2018 README.markdown
    -rw-rw-r--. 1 1000 1000 8972 May 15 2018 README-windows.txt
    drwxrwxr-x. 2 1000 1000 52 May 15 2018 util

    2、openresty是基于那个nginx版本开发

    [root@luoahong openresty-1.13.6.2]# cd bundle/
    [root@luoahong bundle]# ls
    .....
    encrypted-session-nginx-module-0.08 nginx-1.13.6 #是基于这个版本开发的 
    ......
    lua-resty-upload-0.10 xss-nginx-module-0.06

    3、集成了很多第三方模块 是作者张亦春写的

    [root@luoahong bundle]# ls
    ......
    lua-redis-parser-0.13 opm-0.0.5
    lua-resty-core-0.1.15 pod
    lua-resty-dns-0.21 rds-csv-nginx-module-0.09
    lua-resty-limit-traffic-0.05 rds-json-nginx-module-0.15
    lua-resty-lock-0.07 redis2-nginx-module-0.15
    lua-resty-lrucache-0.08 redis-nginx-module-0.3.7
    lua-resty-memcached-0.14 resty-cli-0.21
    lua-resty-mysql-0.20 resty.index
    lua-resty-redis-0.26 set-misc-nginx-module-0.32
    lua-resty-string-0.11 srcache-nginx-module-0.31
    lua-resty-upload-0.10 xss-nginx-module-0.06

    3、编译

    1、nginx的第三方模块C模块 lua代码编写的 我们编译主要是编译c目录

    [root@luoahong openresty-1.13.6.2]# ./configure --help|more

    2、核心模块能不能移除

    --without-http_lua_module disable ngx_http_lua_module
    --without-http_lua_upstream_module disable ngx_http_lua_upstream_module

    4、添加Lua代码

    1、如何把lua代码添加到openrester中

    [root@luoahong conf]# pwd
    /usr/local/openresty/nginx/conf
    [root@luoahong conf]# vim nginx.conf
    
    添加如下:
    
    location /lua {
    default_type text/html;
    content_by_lua 'ngx.say("User-Agent: ", ngx.req.get_headers()["User-Agent"])';
    }

    与lua不一致所以不能直接复制过来

    5、运行

    [root@luoahong conf]# ../sbin/nginx
    root@luoahong conf]# ps -ef|grep nginx
    root 18979 1 0 Mar02 ? 00:00:00 nginx: master process ../sbin/nginx
    nobody 18980 18979 0 Mar02 ? 00:00:00 nginx: worker process
    nobody 18981 18979 0 Mar02 ? 00:00:00 nginx: worker process
    nobody 18982 18979 0 Mar02 ? 00:00:01 nginx: cache manager process
    root 19521 18910 0 10:58 pts/0 00:00:00 grep --color=auto nginx
    

    访问测试截图

  • 相关阅读:
    test
    【转载】ASP.NET MVC 3 —— Model远程验证
    【转载】富有客户端技术之——jQuery EasyUI
    【转载】基于ASP.NET Web Application的插件实现,附DEMO
    【转载】浅谈C#中的延迟加载(1)——善用委托
    【转载】Winform开发框架之权限管理系统
    【转载】基于我的Winform开发框架扩展而成的WCF开发框架
    [转载]10大优秀的移动Web应用程序开发框架推荐
    [转载]C#泛型列表List<T>基本用法总结
    [转载]推荐一个被大家忽视的微软的反跨站脚本库AntiXSS V3.1
  • 原文地址:https://www.cnblogs.com/luoahong/p/12401105.html
Copyright © 2011-2022 走看看