Web - nginx安装
about
使用yum安装
centos7.9
直接yum进行安装,顺便把ab压测工具也安装了:
[root@cs ~]# yum install nginx httpd-tools -y
[root@cs ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# 推荐使用systemctl来管理nginx
[root@cs ~]# systemctl start nginx
[root@cs ~]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 22625 root 6u IPv4 100619020 0t0 TCP *:http (LISTEN)
nginx 22625 root 7u IPv6 100619021 0t0 TCP *:http (LISTEN)
nginx 22626 nginx 6u IPv4 100619020 0t0 TCP *:http (LISTEN)
nginx 22626 nginx 7u IPv6 100619021 0t0 TCP *:http (LISTEN)
nginx 22627 nginx 6u IPv4 100619020 0t0 TCP *:http (LISTEN)
nginx 22627 nginx 7u IPv6 100619021 0t0 TCP *:http (LISTEN)
AliYunDun 29443 root 17u IPv4 91240636 0t0 TCP cs:39994->100.100.30.26:http (ESTABLISHED)
其他:
/var/log/nginx/access.log # nginx的日志位置
/var/log/nginx/error.log # nginx错误日志
/usr/share/nginx/ # nginx安装目录
# 压测,生成一些数据, -n表示访问多少次;-c表示多少个并发,注意,路径最后一定跟/
ab -n 100 -c 10 http://10.0.0.200/
that's all