《Nginx核心技术》第1章:安装Nginx

作者:冰河

星球:m6z.cn/6aeFbs

博客:binghe.gitcode.host

文章汇总:binghe.gitcode.host/md/all/all....

星球项目地址:binghe.gitcode.host/md/zsxq/int...

沉淀,成长,突破,帮助他人,成就自我。

  • 本章难度:★☆☆☆☆
  • 本章重点:用最简短的篇幅介绍Nginx最核心的知识,理解Nginx的安装方式,并能够灵活运用到实际项目中,维护高可用系统。

大家好,我是冰河~~

今天给大家介绍《Nginx核心技术》的第1章:安装Nginx,多一句没有,少一句不行,用最简短的篇幅讲述Nginx最核心的知识,好了,开始今天的内容。

注意:这里以CentOS 7服务器为例,以root用户身份来安装Nginx。

一、安装依赖环境

bash 复制代码
yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devel libjpeg* libpng* freetype* autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel* libaio libaio-devel  bzr libtool

二、安装openssl

bash 复制代码
wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz
tar -zxvf openssl-1.0.2s.tar.gz
cd /usr/local/src/openssl-1.0.2s
./config --prefix=/usr/local/openssl-1.0.2s
make
make install

三、安装pcre

bash 复制代码
wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.43/pcre-8.43.tar.gz
tar -zxvf pcre-8.43.tar.gz
cd /usr/local/src/pcre-8.43
./configure --prefix=/usr/local/pcre-8.43
make
make install

四、安装zlib

bash 复制代码
wget https://www.zlib.net/fossils/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd /usr/local/src/zlib-1.2.11
./configure --prefix=/usr/local/zlib-1.2.11
make
make install

五、安装Nginx

bash 复制代码
wget http://nginx.org/download/nginx-1.25.1.tar.gz
tar -zxvf nginx-1.25.1.tar.gz
cd /usr/local/src/nginx-1.25.1
./configure --prefix=/usr/local/nginx-1.25.1 --with-openssl=/usr/local/src/openssl-1.0.2s --with-pcre=/usr/local/src/pcre-8.43 --with-zlib=/usr/local/src/zlib-1.2.11 --with-http_ssl_module
make
make install

这里需要注意的是:安装Nginx时,指定的是openssl、pcre和zlib的源码解压目录,安装完成后Nginx配置文件的完整路径为:/usr/local/nginx-1.25.1/conf/nginx.conf。

好了,相信各位小伙伴们都能熟练安装Nginx了,我是冰河,我们下期见~~

相关推荐
hrrrrb2 分钟前
【Spring Security】Spring Security 概念
java·数据库·spring
小信丶3 分钟前
Spring 中解决 “Could not autowire. There is more than one bean of type“ 错误
java·spring
周杰伦_Jay1 小时前
【Java虚拟机(JVM)全面解析】从原理到面试实战、JVM故障处理、类加载、内存区域、垃圾回收
java·jvm
程序员小凯5 小时前
Spring Boot测试框架详解
java·spring boot·后端
豐儀麟阁贵5 小时前
基本数据类型
java·算法
_extraordinary_5 小时前
Java SpringMVC(二) --- 响应,综合性练习
java·开发语言
程序员 Harry6 小时前
深度解析:使用ZIP流式读取大型PPTX文件的最佳实践
java
椎4956 小时前
苍穹外卖前端nginx错误之一解决
运维·前端·nginx
wxweven6 小时前
校招面试官揭秘:我们到底在寻找什么样的技术人才?
java·面试·校招
陈陈爱java7 小时前
新知识点背诵
java