添加nginx到yum源
代码语言:javascript复制sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装nginx
代码语言:javascript复制sudo yum install -y nginx
开机自启
代码语言:javascript复制sudo systemctl enable nginx
启动nginx
代码语言:javascript复制sudo systemctl start nginx
验证是否启动成
代码语言:javascript复制http://ip:80 (nginx默认80端口)
nginx配置信息
代码语言:javascript复制网站文件存放默认目录:/usr/share/nginx/html
网站默认站点配置:/etc/nginx/conf.d/default.conf
自定义Nginx站点配置文件存放目录:/etc/nginx/conf.d/
Nginx全局配置:/etc/nginx/nginx.conf