Linux-解决tar解压文件时报错“gzip: stdin: not in gzip format”

遇到的问题:在安装Nginx时,用wget下载Nginx安装包后,使用tar命令进行解压,结果提示如下报错

[[email protected]~]# ll
-rwxrwxrwx. 1 root root 1087 Aug 24 21:55 nginx-1.18.0.tar.gz
[[email protected]~]# tar -zxvf nginx-1.18.0.tar.gz 

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Linux-解决tar解压文件时报错“gzip: stdin: not in gzip format”

 ①可能是压缩包格式的问题(非gzip格式),于是尝试使用命令参数

tar -xf nginx-1.18.0.tar.gz

tar -xvf nginx-1.18.0.tar.gz

结果还是报错

Linux-解决tar解压文件时报错“gzip: stdin: not in gzip format”

②想到可能不是压缩包本身的问题,查看文件类型

原来是使用wget命令下载的Nginx安装包有问题,根本不是压缩包

Linux-解决tar解压文件时报错“gzip: stdin: not in gzip format”

③在Nginx官网手动下载安装包,然后上传到Linux服务器进行解压(压缩包没有问题)解压成功。

Linux-解决tar解压文件时报错“gzip: stdin: not in gzip format”

 Linux-解决tar解压文件时报错“gzip: stdin: not in gzip format”

 Linux-解决tar解压文件时报错“gzip: stdin: not in gzip format”