CentOS编译安装Nginx
dnf install -y gcc git zlib zlib-devel pcre pcre-devel perl-IPC-Cmd git clone --recursive https://hub.fastgit.org/google/ngx_brotli.git cd ngx_brotli/deps git clone https://github.com/google/brotli.git cd brotli/research git clone --recursive https://github.com/hillbig/esaxx git clone --recursive https://github.com/y-256/libdivsufsort.git cd ../../.. git submodule update --init --recursive cd .. wget https://nginx.org/download/nginx-1.20.2.tar.gz tar -xzf nginx-1.20.2.tar.gz wget https://hub.fastgit.org/openssl/openssl/archive/refs/tags/openssl-3.0.0.tar.gz tar -xzf openssl-3.0.0.tar.gz cd nginx-1.20.2 sed -i 's|"nginx/"|"fangd.net/"|g' src/core/nginx.h sed -i 's|"Server: nginx"|"Server: "|g' src/http/ngx_http_header_filter_module.c sed -i 's|"Server: ".*CRLF|"Server: fangd.net" CRLF|g' src/http/ngx_http_header_filter_module.c sed -i 's|<center>nginx</center>|<center>fangd.net</center>|g' src/http/ngx_http_special_response.c sed -i 's|"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF|""|g' src/http/ngx_http_special_response.c sed -i 's|<center>" .* "</center>|<center>" "fangd.net" "</center>|g' src/http/ngx_http_special_response.c sed -i 's|"$CFLAGS -g"|"$CFLAGS"|g' auto/cc/gcc sed -i 's|NGX_GCC_OPT="-O"|NGX_GCC_OPT="-O3"|g' auto/cc/gcc ./configure \ --prefix=/usr/share/nginx \ --sbin-path=/usr/sbin/nginx \ --modules-path=/usr/lib64/nginx/modules \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --http-client-body-temp-path=/var/lib/nginx/tmp/client_body \ --http-proxy-temp-path=/var/lib/nginx/tmp/proxy \ --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi \ --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi \ --http-scgi-temp-path=/var/lib/nginx/tmp/scgi \ --pid-path=/run/nginx.pid \ --lock-path=/run/lock/subsys/nginx \ --user=nginx --group=nginx \ --with-file-aio \ --with-http_auth_request_module \ --with-http_dav_module \ --with-http_degradation_module \ --with-http_flv_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_mp4_module \ --with-http_realip_module \ --with-http_ssl_module \ --with-http_sub_module \ --with-http_v2_module \ --with-mail_ssl_module \ --with-pcre \ --with-pcre-jit \ --with-stream \ --with-stream_ssl_module \ --with-stream_ssl_preread_module \ --with-threads \ --with-openssl=../openssl-openssl-3.0.0 \ --add-module=../ngx_brotli \ --with-cc-opt='-O3 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -DNDEBUG -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -march=native -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,-E' make -j4 make install
本文版权,除注明引用的部分外,归作者所有。本文严禁商业用途的转载。非商业用途的转载需在网页明显处署上作者名称及原文链接。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)