Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包,最可靠解决方案--压缩包安装。

相信很多小伙伴 使用yum安装ngnix出现如下问题:

yum -y install nginx

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    没有可用软件包 nginx。
    错误:无须任何处理

网上有很多方案,但我现在示范的是最可靠的方案–压缩包安装
首先 通过手动下载安装包解压安装:

1.下载nginx包。

[root@localhost ~]# wget http://nginx.org/download/nginx-1.10.1.tar.gz

Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包,最可靠解决方案--压缩包安装。_第1张图片

2.复制包到你的安装目录

[root@localhost ~]# cp nginx-1.10.1.tar.gz /usr/local/

3.切换目录并解压

[root@localhost ~]# cd /usr/local
[root@localhost  local]# tar -zxvf nginx-1.10.1.tar.gz

注明: local这个目录类似于Windows的program目录,所以一些软件可以都安装在这里.

4.进行configure配置

[root@localhost local]# cd nginx-1.10.1 
   [root@localhost  nginx-1.10.1 ]#  ./configure --prefix=/usr/local/nginx

5.编译安装

[root@localhost nginx-1.10.1]# make && make install

6.启动Nginx

[root@localhost ~]#  systemctl start nginx.service

最后在网页输入ip,即可出现如下画面,即代表成功:
Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包,最可靠解决方案--压缩包安装。_第2张图片
有或者 在linux输入:systectl status ngnix.service
在这里插入图片描述running代表成功
有或者使用命令:ps -ef |grep ngnix.service
Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包,最可靠解决方案--压缩包安装。_第3张图片
出现三个ngnix进程,代表成功

你可能感兴趣的:(linux,nginx,运维)