1.添加Nginx到yum源
# sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.安装Nginx
# yum install -y nginx
3.启动Nginx服务
# systemctl start nginx.service
4.设置nginx开机自启
# systemctl enable nginx.service
5.验证安装是否成功,在centos7打开火狐,输入网址(本机IP,终端ifconfig命令查看),如下图表示安装成功
Nginx配置信息
网站文件存放默认目录
/usr/share/nginx/html
网站默认站点配置
/etc/nginx/conf.d/default.conf
自定义Nginx站点配置文件存放目录
/etc/nginx/conf.d/
Nginx全局配置
/etc/nginx/nginx.conf
Nginx启动
nginx -c nginx.conf