返回首页DA系统C#IDE文件同步服务屏保 今天是: 2026-05-05    "立夏"  夏季的第一个节气,表示盛夏时节的正式开始

搜索
热搜: linux 技术
Hi~登录注册
查看: 1890|回复: 0

[转载] 【转载】linux免安装nginx,Nginx免安装包制作工具:Nginx-portable

[复制链接]
发表于 2023-3-15 11:08:28 | 显示全部楼层 |阅读模式

少侠不来段修仙之旅吗~

您需要 登录 才可以下载或查看,没有帐号?注册成为修仙之旅的少年~

x
linux免安装nginx,Nginx免安装包制作工具:Nginx-portable



最近在捣鼓离线版Nginx,本来打算制作成rpm包,可惜技术不到位,只能改变思路,把Nginx编译成免安装的二进制包,类似于Tomcat,直接去start就能使用,所以找到了nginx-portable,快捷编译Nginx为二进制包的工具。

安装依赖包:
Ubuntu&Debian:
sudo apt-get install perl git curl unzip build-essential libpcre3-dev libssl-dev -y

CentOS:
yum install gcc-c++ pcre perl git unzip pcre-devel zlib zlib-devel openssl openssl-devel -y

装完依赖后,我们安装nginx-portable主程序:
wget https://github.com/nuccch/nginx-portable/archive/master.zip
unzip master.zip

cd nginx-portable-master/

到此,程序安装完成,我们开始进行编译,我们首先需要确定Nginx版本,具体看官网确定版本号:http://nginx.org/en/download.html


举个例子,我们要编译1.16.1版本:
然后执行:
bash compile 1.16.1

注意:本脚本需要连接外网下载Nginx源码包,如果在没有连接网络的情况下使用,请先下载好Nginx的源码包存在脚本指定中的路径下,脚本就会判定已经下载完成,直接开始编译程序。
其他版本以此类推,编译完成后,会在当前目录的build目录下生成一个已经编译好的nginx文件:
nginx-.tar.gz


查看脚本./configure配置为,如需修改可根据实际情况修改:
./configure --prefix=. --sbin-path=sbin/ --conf-path=conf/nginx.conf --error-log-path=logs/error.log --http-client-body-temp-path=tmp/client_body_temp/ --http-proxy-temp-path=tmp/proxy_temp/ --http-fastcgi-temp-path=tmp/fastcgi_temp/ --http-uwsgi-temp-path=tmp/uwsgi_temp/ --http-scgi-temp-path=tmp/scgi_temp/ --with-ipv6 --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_fastcgi_module > ../../logs/compile.log


把此文件直接拷贝到目标主机解压即可使用。
如何管理Nginx?
启动:cd /nginx/sbin && ./nginx
停止:./nginx -s stop
重启:./nginx -s reload
检查配置正确性:./nginx -t
查看Nginx版本信息:./nginx -v






游客
回复
*滑块验证:

DA论坛飞机票来了~
快速回复 返回顶部 返回列表