LAMP服务器优化---Nginx

本文将服务器Apache换成Nginx
在Nginx下优化对比Apache的性能。
下载Nginx源码包

wget http://nginx.org/download/nginx-1.10.3.tar.gz

下载 zlib

wget http://www.zlib.net/zlib-1.2.11.tar.gz

下载OpenSSL

wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz

将zlib openssl解压到 Nginx/src 目录下
编译安装

./configure --prefix=/usr/local/nginx --with-zlib=src/zlib --with-openssl=src/openssl

nginx启动/停止/重载
To start nginx, run the executable file. Once nginx is started, it can be controlled by invoking the executable with the -s parameter. Use the following syntax:
nginx -s signal
Where signal may be one of the following:
stop — fast shutdown
quit — graceful shutdown
reload — reloading the configuration file
reopen — reopening the log files
配置nginx fcgi代理
这里写图片描述
重启Nginx
通过 ab 模拟1000个客户端发起200000个并发请求
这里写图片描述
nginx能够接受的请求太小了。
更改worker进程的最大打开文件数限制。
这里写图片描述
再次测试
这里写图片描述
cpu及/io
这里写图片描述
内存
这里写图片描述
开始优化
修改如下配置
这里写图片描述
再次测试
这里写图片描述
cpu/io
这里写图片描述
内存
这里写图片描述

经过调节后,每秒并发达到了10K多。内存的使用也相对较少了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值