添加nginx到yum源

sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装nginx

sudo yum install -y nginx

开机自启

sudo systemctl enable nginx

启动nginx

sudo systemctl start nginx

验证是否启动成

http://ip:80 (nginx默认80端口)

nginx配置信息

网站文件存放默认目录:/usr/share/nginx/html
网站默认站点配置:/etc/nginx/conf.d/default.conf
自定义Nginx站点配置文件存放目录:/etc/nginx/conf.d/
Nginx全局配置:/etc/nginx/nginx.conf

Q.E.D.


一个热爱生活的95后精神小伙