Linux下安装Nginx

nginx做反向代理,hexo应用通过nginx转发,并配置域名。

centos安装:http://nginx.org/en/linux_packages.html#RHEL-CentOS
先决条件安装:sudo yum install yum-utils
设置yum仓库,创建文件:/etc/yum.repos.d/nginx.repo

默认安装在/etc/nginx
内容如下

[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

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

 

安装主线nginx包:sudo yum-config-manager –enable nginx-mainline
安装稳定版:sudo yum install nginx

检查nginx的安装路径:

[root@fubin ~]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz

 

 
上一篇:centos7下安装nginx


下一篇:安装nginx1.16.1版本