Linux centos7环境下安装Nginx的步骤详解
1、首先到Nginx官网下载Nginx安装包
http://nginx.org/download/nginx-1.5.9.tar.gz
下载好后会见到类似下面的一份文件
创建nginx-src目录并且去到nginx-src目录里运行如下命令即可:
mkdir nginx-src && cd nginx-src
当然也可以在Linux底下运行以下命令进行下载Nginx安装包
wget http://nginx.org/download/nginx-1.5.9.tar.gz
2、解压nginx-1.5.9.tar.gz文件
tar -zxvf nginx-1.5.9.tar.gz
3、删除安装包文件命令
rm -f nginx-1.5.9.tar.gz
4、配置安装运行命令
cd nginx-1.5.9/
./configure --prefix=/usr/local/nginx
也许是提示缺包:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre= option.
安装pcre-devel解决问题(需要有网络下运行并且是超级管理员身份)
yum -y install pcre-devel
yum -y install openssl openssl-devel