Nginx 1.25.4 编译安装
Nginx 1.25.4 源码编译安装
最新长期技术支持版本 nginx-1.25.4,官方下载源码包:
https://nginx.org/download/nginx-1.25.4.tar.gz
一键安装脚本
不啰嗦,脚本简单快速编译安装
#! /bin/bash #安装相关包 yum -y install gcc pcre-devel openssl-devel zlib-devel make wget #创建用户 id nginx || useradd -r -s /sbin/nologin nginx cd /usr/local/src/ #下载nginxan安装包 wget https://nginx.org/download/nginx-1.25.4.tar.gz #解压编译安装 tar xf nginx-1.25.4.tar.gz cd nginx-1.25.4/ ./configure --prefix=/apps/nginx \ --user=nginx \ --group=nginx \ --with-http_ssl_module \ --with-http_v2_module \ --with-http_realip_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --with-pcre \ --with-stream \ --with-stream_ssl_module \ --with-stream_realip_module make -j `lscpu |grep '^CPU(s)' |awk '{print $2}'` && make install #设置权限 mkdir /apps/nginx/run/ -p chown -R nginx.nginx /apps/nginx #设置软链接 ln -s /apps/nginx/sbin/nginx /usr/sbin/ #设置开机自启服务文件 cat > /usr/lib/systemd/system/nginx.service <<EOF [Unit] Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/apps/nginx/run/nginx.pid ExecStart=/apps/nginx/sbin/nginx -c /apps/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target EOF #准备相关自启配置文件 sed -i 's@^#pid .*/nginx.pid;@pid /apps/nginx/run/nginx.pid;@' /apps/nginx/conf/nginx.conf systemctl daemon-reload systemctl enable --now nginx
标签:
nginx 编译安装
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2023-04-07 ERROR 658 (HY000): Proxy ERROR: Join internal error: Table 'mysql.proc' doesn'texist