Fork me on github

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
posted @   fang-d  阅读(241)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示