linux(centos7)上部署nginx-1.9.9

第一步:选择自己想要安装的位置,创建nginx的相关文件夹,然后执行wget https://nginx.org/download/nginx-1.9.9.tar.gz

第二步:解压 tar -zxvf nginx-1.9.9.tar.gz,解压后进入解压后的文件中如 cd nginx-1.9.9

第三步:执行./configure --prefix=/opt/tools/nginx/nginx-1.9.9 --conf-path=/opt/tools/nginx/nginx-1.9.9/nginx.conf --with-http_ssl_module (prefix和path后的内容都是你自己安装的路径),此时可能出现报错

<1>,./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=<path> option.

解决方式:安装pcre-devel解决问题 yum -y install pcre-devel

<2>,./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option.

解决方式:安装zlib wget http://www.zlib.net/zlib-1.2.11.tar.gz ,解压 tar -xzvf zlib-1.2.11.tar.gz依次执行

cd zlib-1.2.11

./configure

make

make install

此时过程中若出现报错:checking for OS Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler . 则需安装:yum -y install gcc

<3>,./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=<path> option.

则安装yum -y install openssl openssl-devel,安装完毕再重新执行添加ssl的命令,完毕后执行make和make install

第五步:启动,停止,重启的方式

<1>,启动:进入nginx的sbin目录下./nginx即可

<2>,停止:ps -ef | grep nginx 找到进程id然后kill -9 进程id

<3>,重启:通常修改了nginx的配置文件需要重启一下nginx,修改完毕配置文件先进入sbin目录下./nginx -t检查修改无误,然后重启使修改生效,./nginx -s reload

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值