(这里不使用docker安装nginx,是直接yum装到宿主机)
使用官方源安装nginx:
添加nginx官方yum源: Nginx 不在默认的 yum 源中,使用官网的 yum 源
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
systemctl start nginx
开机启动
systemctl enable nginx
当然也可以使用epel源安装:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install -y nginx
查看进程:
ps -ef | grep nginx
nginx配置信息:
# 网站文件存放默认目录 /usr/share/nginx/html # 网站默认站点配置 /etc/nginx/conf.d/default.conf # 自定义Nginx站点配置文件存放目录 /etc/nginx/conf.d/ # Nginx全局配置 /etc/nginx/nginx.conf
如果修改了配置,那么使用如下命令进行无缝重载网站:
nginx -s reload
让nginx指定配置文件启动
nginx -c /home/ua07/nginx