作者:Qualcommtjmag_716 | 来源:互联网 | 2023-08-09 22:01
1、安装
下载RPM:wget
http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.10.0-1.el7.ngx.x86_64.rpm
安装: rpm -ivh
nginx-1.10.0-1.el7.ngx.x86_64.rpm
如果找不wget请安装,命令:yum -y install wget
2、安装成功后nginx的几个默认目录
输入命令: whereis nginx
执行目录:/usr/sbin/nginx
模块所在目录:/usr/lib64/nginx/modules
配置所在目录:/etc/nginx/
默认站点目录:/usr/share/nginx/html
主要配置文件:/etc/nginx/nginx.conf 指向:/etc/nginx/conf.d/default.conf
PID目录:/var/run/nginx.pid
错误日志:/var/log/nginx/error.log
访问日志:/var/log/nginx/access.log
3、查看nginx状态(未启动前)
命令1:systemctl status nginx.service
4、启动、停止、重载命令
systemctl start nginx.service
systemctl stop nginx.service
systemctl reload nginx.service
systemctl status nginx.service
5、查看nginx的状态及进程与端口(启动后)
命令1:systemctl status nginx.service
以上nginx就已安装成功了!!!
命令2:netstat -antp | grep :80(查看80端口被哪个服务占用)or netstat -antpuel | grep ":22" | grep -v grep(过虑grep本身)
命令3:netstat -antp | grep :(查看所有端口占用情况)
命令4:ps aux | grep nginx(查看nginx进程运行状态)or ps aux | grep :80 | grep -v grep(过虑grep本身)
6、杀掉进程命令
a)相关nginx进行全部杀掉:killall -9 nginx
b)把PID两个进程杀掉:kill -9 pid1 and kill -9 pid1
7、查看版本
命令:nginx -V