linux版本:CentOS7 64位
在安装nginx前首先要确认系统中安装了gcc、pcre-devel、zlib-devel、openssl-devel。
Linux下检查是否安装过某软件包:http://www.cnblogs.com/xxoome/p/5866553.html
安装命令:
yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
nginx下载地址:https://nginx.org/download/
下载“nginx-1.19.7.tar.gz”到/usr/local/soft/下。
解压
tar -zxvf nginx-1.19.7.tar.gz
##进入nginx目录
cd nginx-1.19.7
配置
./configure --prefix=/usr/local/soft/nginx
make
OK,现在可以执行make 了。
make
make install
测试是否安装成功
cd到刚才配置的安装目录/usr/loca/nginx/
./sbin/nginx -t
正常情况的信息输出:
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
启动nginx
cd /usr/local/nginx/sbin
./nginx
成功!