CentOS 7下安装配置Nginx
本文基于 CentOS 7 下安装配置 Nginx 操作实践记录整理。
一、配置 EPEL 源
sudo yum install -y epel-release
sudo yum -y update
二、安装 Nginx
sudo yum install -y nginx
安装成功后,默认的网站目录为: /usr/share/nginx/html
默认的配置文件为:/etc/nginx/nginx.conf
自定义配置文件目录为: /etc/nginx/conf.d/
三、操作 Nginx
# 启动 Nginx sudo systemctl start nginx # 停止 Nginx sudo systemctl stop nginx #重启 Nginx sudo systemctl restart nginx #查看 Nginx 状态 systemctl status nginx # 启用开机启动 Nginx systemctl enable nginx # 禁用开机启动 Nginx systemctl disable nginx