安装nginx
yum -y install nginx
开启nginx服务
systemctl enable nginx
systemctl start nginx
查看nginx进程是否启动成功
ps -ef|grep nginx
如上图所示:看到master process 和 worker process都有,说明服务已经启动
查看默认端口80是否正在被nginx监听
netstat -antlp |grep 80
如图所示:正在被nginx监听,如果80端口被占用,则使用pkill -9 80 命令来杀死80端口,再次重启nginx
修改nginx.conf配置文件
yum -y install mlocate&&updatedb #安装mlocate包,并更新根目录信息
locate nginx.conf #查找ng