Nginx-安装
1.yum安装nginx
①在/etc/yum.repos.d下创建nginx.repo
vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
②开始安装
yum install nginx
③查看安装版本
nginx -V
2. 自行编译安装nginx
下载nginx包并解压: tar -zxvf nginx-1.16.0.tar.gz
进入解压目录:cd nginx-1.16.0/
编译:./configure
创建nignx用户:useradd nginx
设置目录权限:chown nginx.nginx /usr/local/nginx
查看版本
cd /usr/local/nginx/sbin
/nginx -v