《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了,我是冰河,我们下期见~~

相关推荐
fire-flyer29 分钟前
Spring Boot 源码解析之 Logging
java·spring boot·spring·log4j·logging
KoiHeng2 小时前
部分排序算法的Java模拟实现(复习向,非0基础)
java·算法·排序算法
cui_hao_nan5 小时前
JVM——如何对java的垃圾回收机制调优?
java·jvm
熟悉的新风景7 小时前
springboot项目或其他项目使用@Test测试项目接口配置-spring-boot-starter-test
java·spring boot·后端
心平愈三千疾7 小时前
学习秒杀系统-实现秒杀功能(商品列表,商品详情,基本秒杀功能实现,订单详情)
java·分布式·学习
玩代码7 小时前
备忘录设计模式
java·开发语言·设计模式·备忘录设计模式
BUTCHER57 小时前
Docker镜像使用
java·docker·容器
岁忧8 小时前
(nice!!!)(LeetCode 面试经典 150 题 ) 30. 串联所有单词的子串 (哈希表+字符串+滑动窗口)
java·c++·leetcode·面试·go·散列表
KevinWang_9 小时前
我的阅读解决方案
程序员
LJianK19 小时前
Java和JavaScript的&&和||
java·javascript·python