NGINX源码安装
2021/6/1 7:25:23
本文主要是介绍NGINX源码安装,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、准备环境
node01 192.168.0.2 CentOS Linux release 7.6.1810 (Core)
安装包:http://nginx.org/download/nginx-1.20.1.tar.gz
二、安装步骤
1、下载安装包
wget -c http://nginx.org/download/nginx-1.20.1.tar.gz
2、解压安装包
[root@node01 ~]# tar xf nginx-1.20.1.tar.gz
[root@node01 ~]# ls
anaconda-ks.cfg nginx-1.20.1 nginx-1.20.1.tar.gz ssx_test
[root@node01 ~]# cd nginx-1.20.1
[root@node01 nginx-1.20.1]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@node01 nginx-1.20.1]#
3、预编译
预编译主要用于检查系统环境是否具备安装软件包的条件,并生成Makefile文件,改文件为编译、安装、升级nginx指明了相应参数。
[root@node01 nginx-1.20.1]# ./configure --prefix=/usr/local/nginx
预编译命令详解:
./configure --help 可以查看预编译参数
--prefix 指定nginx编译安装的目录;
--user=*** 指定nginx的属主
--group=*** 指定nginx的属主的属组
--with-*** 指定编译某模块(默认不会编译)
--without-** 指定不编译某模块(默认会编译)
--add-module 编译第三方模块
4、编译并安装
[root@node01 nginx-1.20.1]# make && make install
查看nginx服务进程
访问测试页:
基于安全考虑下图版本信息需要屏蔽:
因此,升级nginx,步骤如下:
1、修改core模块的nginx.h
2、预编译&安装&升级
[root@node01 core]# /usr/local/nginx/sbin/nginx -V
nginx version: sugonweb/2.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
configure arguments: --prefix=/usr/local/nginx/ --with-http_stub_status_module
[root@node01 nginx-1.20.1]# ./configure --prefix=/usr/local/nginx/ --with-http_stub_status_module
[root@node01 nginx-1.20.1]# make && make install && make upgrade
3、登录验证
这篇关于NGINX源码安装的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-17Nginx实用篇:实现负载均衡、限流与动静分离
- 2024-08-21宝塔nginx新增8022端口方法步骤-icode9专业技术文章分享
- 2024-08-21nginx配置,让ws升级为wss访问的方法步骤-icode9专业技术文章分享
- 2024-08-15nginx ws代理配置方法步骤-icode9专业技术文章分享
- 2024-08-14nginx 让访问带有/relid的地址返回404 ,例子 /relid-x-0.36-y-131.html-icode9专业技术文章分享
- 2024-08-14nginx 判断地址有/statics/的路径,指向到/home/html/statics/目录-icode9专业技术文章分享
- 2024-07-24解锁Nginx日志的宝藏:GoAccess——你的实时、交互式Web日志分析神器!
- 2024-03-29fail2ban nginx
- 2024-03-18install nginx proxy manager
- 2024-01-2444从零开始用Rust编写nginx,命令行参数的设计与解析及说明