zoukankan      html  css  js  c++  java
  • nginx之升级openssl及自定义nginx版本

    favicon.ico浏览器图标配置

    favicon.ico 文件是浏览器收藏网址时显示的图标,当客户端使用浏览器问页面时,浏览器会自己主动发起请求获取页面的favicon.ico文件,但是当浏览器请求的favicon.ico文件不存在时,服务器会记录404日志,而且浏览器也会显示404报错。
    
    location = /favicon.ico {     #使用完全匹配,优先级最高
           root /data/nginx/pc/images;    #设计好的favicon.ico文件需要在这个指定好的目录下
       }
    

    自定Nginx的版本号和server name

    [root@app nginx-1.16.1]# vim /usr/local/src/nginx-1.16.1/src/http/ngx_http_header_filter_module.c    #编辑nginx源码包的这个文件
    static u_char ngx_http_server_string[] = "Server: Nginx" CRLF;
       
    修改这一行,把这一行中的Nginx改成自己想定义的server name,如:Apache/2.4.6;这一行在第49行;修改完成后需要重新编译nginx
    

    升级OpenSSL版本

    心脏出血(英语:Heartbleed),也简称为心血漏洞,是一个出现在加密程序库OpenSSL的安全漏洞,该程序库广泛用于实现互联网的传输层安全(TLS)协议。它于2012年被引入了软件中,2014年4月首次向公众披露。只要使用的是存在缺陷的OpenSSL实例,无论是服务器还是客户端,都可能因此而受到攻击。此问题的原因是在实现TLS的心跳扩展时没有对输入进行适当验证(缺少边界检查),因此漏洞的名称来源于“心跳”(heartbeat)。该程序错误属于缓冲区过读,即可以读取的数据比应该允许读取的还多。
    

    openssl下载地址: https://www.openssl.org/source/

    [root@app ~]# nginx -s stop      #重新编译nginx前需要先停服务,如果不停Nginx,会造成nginx的二进制程序无法被替换
    [root@app ~]# cd /usr/local/src/
    [root@app src]# tar xf openssl-1.1.1d.tar.gz
    [root@app src]# cd nginx-1.16.1/    #进入Nginx源码包从新编译Nginx
    [root@app nginx-1.16.1]# ./configure --help | grep "openssl"
    --with-openssl=DIR      #需要添加这个参数
    [root@app nginx-1.16.1]# ./configure --prefix=/apps/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module --with-file-aio --add-module=/usr/local/src/echo-nginx-module --with-openssl=/usr/local/src/openssl-1.1.1d    #添加openssl的参数后,指定openssl的源码路径,从新编译
    [root@app nginx-1.16.1]# make -j 4 && make install
    [root@app nginx-1.16.1]# nginx
    [root@app nginx-1.16.1]# nginx -V       
    built with OpenSSL 1.1.1d  10 Sep 2019      #更新完成
    
    更新完openssl,旧版本的证书等不需要修改,新版本兼容旧版本,就是把旧版本的漏洞补上了
  • 相关阅读:
    梦断代码阅读笔记之一
    市场调研
    站立会议第九天
    站立会议第八天
    站立会议第七天
    站立会议第六天
    站立会议第五天
    团队项目第一阶段冲刺站立会议6(4月23日)
    团队项目第一阶段冲刺站立会议5(4月22日)
    团队项目第一阶段冲刺站立会议4(4月21日)
  • 原文地址:https://www.cnblogs.com/dongzhanyi123/p/12081506.html
Copyright © 2011-2022 走看看