Alpine编译nginx

更新于 2024-08-05

编译环境

apk add make zlib zlib-dev libtool openssl openssl-dev gcc g++ make automake autoconf binutils icu-libs

安装PCRE

wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
tar -zxvf ./pcre-8.35.tar.gz
cd pcre-8.35 && ./configure && make && make install
pcre-config --version

安装nginx

wget https://nginx.org/download/nginx-1.26.1.tar.gz
tar -zxvf ./nginx-1.26.1.tar.gz
cd nginx-1.26.1
./configure --prefix=/www/server/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/pcre-8.35
make && make install

配置nginx

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www

vi /www/server/nginx/conf/nginx.conf
#第一行添加用户组
user www www;