试验前准备如果配置文件打不开,删除交换文件
交换文件产生(缓存文件)
修改文件时,不保存 强制退出vim、强制断开终端会产生交换文件
1、还原配置文件
启服务
cd /usr/local/nginx/
[root@proxy nginx]# cp conf/nginx.conf.default conf/nginx.conf
cp:是否覆盖"conf/nginx.conf"? y
[root@proxy nginx]# sbin/nginx
[root@proxy nginx]# sbin/nginx -s reload
2、访问测试,查看端口
netstat -ntulp | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1690/nginx: master
[root@proxy nginx]# curl 192.168.2.5
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
让Nginx支持超长地址
cd -
/usr/local/nginx
vim conf/nginx.conf
client_header_buffer_size 200k; #用户访问地址栏长度支持200k大小
large_client_header_buffers 4 200; #如果不够再给4个200k
[root@proxy nginx]# sbin/nginx -s reload
[root@proxy nginx]# cd -
/root/lnmp_soft
[root@proxy lnmp_soft]# ./buffer.sh 访问测试,看不到414报错,则成功
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
网站压力测试工具
[root@web1 ~]# ab -c 200 -n 200 http://192.168.2.5/
ulimit -Hn 100000 同时被打开,硬限制
[root@proxy nginx]# ulimit -Sn 100000 同时被打开, 软限制
[root@proxy nginx]# ulimit -n 查询系统打开文件数量
永久配置
vim /etc/security/limits.conf
G到最后53、54
* soft nofile (文件访问量) 100000
* hard nofile 100000
修改完重启服务器