nginx 安装

1、nginx安装前,必须准备工具包

C语言编译、C++编译使用

 yum -y install gcc gcc-devel gcc-c++

PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式

yum -y install pcre pcre-devel

ZLIB :供数据压缩用的函式库

yum -y install zlib zlib-devel

OPENSSL :在计算机网络上,OpenSSL是一个开放源代码软件包,应用程序可以使用这个包来进行安全通信,避免窃听,同时确认另一端连接者的身份

yum -y install openssl openssl-devel

2、安装nginx

  下载nginx安装包

   http://nginx.org/download/

  wget http://nginx.org/download/nginx-1.15.8.tar.gz

  解压

  tar zxvf http://nginx.org/download/nginx-1.15.8.tar.gz

 参数配置

  解压后,在nginx-1.15.8目录下使用confiregure命令进行安装配置

 ./configure --prefix=/usr/local/nginx 

 配置参数非常多,--prefix为nginx安装的目录,这个参数非常关键,因为其他的参数,

--sbin-path=path ,--error-log-path=path等等都会以这个prefix的路径为基准进行路径设置。

例如:我这里配置--prefix=/usr/local/nginx ,--error-log-path=logs/error.log

那么error-log-path的绝对路径就是:/usr/local/nginx/logs/error.log

可以根据自己的需要继续配置,配置参数语意解析:http://nginx.org/en/docs/configure.html

编译

make && make install

3、nginx环境变量配置

   vi /etc/profile

   export PATH = $PATH:/usr/local/nginx/sbin/

   配置完,即时生效:source /etc/profile

4、启动nginx

     nginx

     nginx其他操作,操作相关参数:http://nginx.org/en/docs/switches.html

     检查nginx的conf文件是否配置正确

     nginx -t

     重载nginx配置文件

     nginx -s reload

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值