使用yum安装nginx

谁践踏了优雅 2022-04-15 02:56 539阅读 0赞

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
http://nginx.org/en/download.html
http://zlib.net/fossils/
https://www.openssl.org/source/old/

一键安装需要的所有依赖

  1. yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

nginx下载地址

  1. http://nginx.org/download/

安装nginx

直接用yum -y install nginx也可以,但是默认的安装目录和平时使用的不太一样,因此采用手动安装的形式。

  1. 解压nginx安装包,从上面的地址官网下载
  2. [root@hadoop soft]# tar -zxvf nginx-1.15.6.tar.gz
  3. 进入到解压的目录
  4. [root@hadoop soft]# cd nginx-1.15.6
  5. 编译一下,configure后面有很多参数,可以使用./configure --help 来查看,如果需要使用SSL和正则表达式,需要指定openssl pcre的安装目录,要不然可能默认路径不一定是依赖包的安装目录,zlib是压缩的依赖包。
  6. 执行编译命令
  7. [root@hadoop nginx-1.15.6]# ./configure
  8. 执行make和安装命令
  9. [root@hadoop nginx-1.15.6]# make && make install
  10. 安装完之后看下这个目录是不是有东西。
  11. /usr/local/nginx
  12. 进入到这个目录执
  13. cd /usr/local/nginx/sbin
  14. 启动nginx命令
  15. [root@hadoop sbin]# ./nginx -c /usr/local/nginx/conf/nginx.conf
  16. 检测nginx配置文件是否正常
  17. [root@hadoop sbin]# ./nginx -t -c /usr/local/nginx/conf/nginx.conf
  18. nginx平滑启动
  19. [root@hadoop sbin]# ./nginx -s reload
  20. 查看openssl 的安装目录
  21. [root@hadoop nginx]# whereis openssl

发表评论

表情:
评论列表 (有 0 条评论,539人围观)

还没有评论,来说两句吧...

相关阅读