Centos 7 安装Nginx1.15.8

安装 make 和 gcc:

yum -y install autoconf automake make
yum -y install gcc gcc-c++ 

安装nginx依赖的库:

yum -y install pcre pcre-devel    
yum -y install zlib zlib-devel
yum install -y openssl openssl-devel

解压

tar -zxvf nginx-1.15.8.tar.gz

进入解压好的目录,执行配置脚本:

cd nginx-1.15.8/
./configure   --prefix=/tools/nginx --with-http_stub_status_module --with-http_ssl_module 

–prefix:指定安装目录
–with-http_stub_status_module:启用 http 状态监控
–with-http_ssl_module:启用 https 模块

creating objs/Makefile 代表编译成功

编译:

make

安装:

make install

配置环境变量:

vim ~/.bash_profile

加入
 

export PATH=$PATH:/tools/nginx/sbin/

source 一下

source ~/.bash_profile

验证安装是否成功:

nginx -t

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章