查看系统中是否已安装 nginx 服务
yum list | grep nginx
查看nginx运行进程
ps -ef | grep nginx
添加源
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装Nginx
yum install -y nginx
查看nginx安装目录
find / -name "nginx"
Nginx默认目录
以下是Nginx的默认路径:
- Nginx配置路径:/etc/nginx/
- PID目录:/var/run/nginx.pid
- 错误日志:/var/log/nginx/error.log
- 访问日志:/var/log/nginx/access.log
- 默认站点目录:/usr/share/nginx/html
- 配置路径 : /etc/nginx/nginx.conf
启动nginx
systemctl start nginx
再次 查看nginx运行进程
ps -ef | grep nginx
访问nginx
地址:192.168.0.1
查看nginx的状态
systemctl status nginx
加入开机启动
systemctl enable nginx
停止Nginx
systemctl stop nginx
查看nginx停止后的的状态