lighttpd (http、https)安装SSL证书

1、简介:Lighttpd是一个轻量级的Web服务器,支持FastCGI, CGI, Auth,输出压缩(output compress), URL重写, Alias等重要功能。它具有非常低的内存开销,cpu占用率低,效能好,以及丰富的模块等特点。其静态文件的响应能力远高于Apache,可谓Web服务器的后期之秀。所以我们采用Lighttpd作为web通信的服务器。

 

配置文件:Lighttpd.conf

修改的几个参数

1、服务器的ip地址server.bind ="" #表示绑定任意一个IP即可

2、服务器的端口server.port  #默认端口为80,即使屏蔽掉此选项

3、Web应用目录server.document-root

4、出错日志输出目录 server.errlog

5、开启cgi功能server.modules = ("mod_cgi") cgi.assign = (".cgi" => "") 设置 cgi 模块的扩展名和解释器

 

 

官网下载最新,源码,编译安装

运行 /qzt/www/bin/lighttpd.sh /qzt/www/bin/lighttpd -f /qzt/www/config/lighttpd.conf -m /qzt/www/lib/  > /dev/null 2>&1&

-f  指定配置文件位置

-m 指定 库路径

-D 前端运行

 

 

2、开启https,ssl加密认证功能

 

生成证书openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes

 

修改配置文件

#server.port = ""   

server.bind = ""                                                      
 

$SERVER["socket"] == ":443" {                                                                                              
ssl.engine = "enable"                              
ssl.pemfile = "/qzt/www/config/server.pem"                            
ssl.cipher-list = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES1
ssl.honor-cipher-order = "enable"                                      
ssl.disable-client-renegotiation = "enable"
}                   

 

注意 ssl.cipher-list 要去掉CRC3,否则会appscan 会扫描出漏洞

 

此时https和http 是可以同时登陆的,如果要关闭http登陆,可以让http 80端口重定向到443端口

 

加入下面配置

$HTTP["scheme"] == "http" {                                            
    # capture vhost name with regex conditiona -> %0 in redirect pattern
    # must be the most inner block to the redirect rule
    $HTTP["host"] =~ ".*" {  
        url.redirect = (".*" => "https://%0$0")                   
    }                                                            
}  

让http 80端口重定向到443端口,server.port = "80" , 此时再去登陆http会发现已经重定向到https

 

 

 

另外,WVS可能还会扫出 DOS攻击 (Slow HTTP Denial of Service Attack)

2种方法:

1、server.max-connections = 4 限制最大连接数

2、server.max-read-idle = 6      限制读超时时间

建议使用第二种

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值