Nginx 隐藏版本
查看方法
[root@localhost bbs]# curl -I http://192.168.235.133
修改配置文件
[root@localhost conf]# vim nginx.conf
[root@localhost conf]# systemctl restart nginx
[root@localhost conf]# curl -I http://192.168.235.133
重新编译安装
[root@localhost nginx-1.15.9]# ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module
make && make install
[root@localhost nginx-1.15.9]# vim /usr/local/nginx/conf/nginx.conf
[root@localhost nginx-1.15.9]# systemctl stop nginx
[root@localhost nginx-1.15.9]# systemctl start nginx
[root@localhost nginx-1.15.9]# curl I http://192.168.235.133
设置缓存时间
[root@localhost nginx-1.15.9]# vim /usr/local/nginx/conf/nginx.conf
[root@localhost html]# vim index.html
[root@localhost html]# systemctl restart nginx
[root@localhost html]# curl I http://192.168.235.133/cat.jpg
日志分割
[root@localhost opt]# vim fenge.sh
[root@localhost opt]# systemctl start nginx
[root@localhost opt]# netstat -natp | grep nginx
给与权限执行分割
[root@localhost opt]# chmod +x fenge.sh
[root@localhost opt]# ls /var/log/nginx
[root@localhost opt]# crontab -e
crontab: installing new crontab
连接超时
[root@localhost conf]# vim /usr/local/nginx/conf/nginx.conf
[root@localhost conf]# nginx -t
更改进程数
[root@localhost conf]# cat /proc/cpuinfo | grep -c "physical"
8
[root@localhost conf]# ps aux | grep nginx
网页压缩
[root@localhost conf]# vim /usr/local/nginx/conf/nginx.conf
[root@localhost conf]# nginx -t
[root@localhost html]# vim index.html
[root@localhost html]# systemctl stop nginx
[root@localhost html]# systemctl start nginx
[root@localhost html]# netstat -natp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13180/nginx: master
防盗链
[root@localhost ~]# vim /etc/hosts
C:\WINDOWS\System32\drivers\etc
[root@localhost html]# vim index.html
[root@localhost html]# systemctl start nginx
[root@localhost html]# netstat -natp | grep nginx
[root@localhost conf]# vim nginx.conf
[root@localhost nginx]# cd html/
[root@localhost html]# ls
[root@localhost html]# nginx -t
[root@localhost html]# systemctl stop nginx
[root@localhost html]# systemctl start nginx