编译环境
nginx编译
- 源码下载并解压(其中有一些库没有,比如说pcre,zlib,请酌情下载源码,有的需要提前安装到系统里,比如说libxslt,酌情处理)
wget http://nginx.org/download/nginx-1.19.6.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
wget https://zlib.net/zlib-1.2.11.tar.gz
wget ftp://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
wget https://www.cpan.org/src/5.0/perl-5.32.1.tar.gz
wget ftp://xmlsoft.org/libxml2/libxslt-git-snapshot.tar.gz
tar -zxvf nginx-1.19.6.tar.gz
tar -zxvf openssl-1.1.1i.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
tar -zxvf pcre-8.44.tar.gz
tar -zxvf perl-5.32.1.tar.gz
cd nginx-1.19.6
./configure --with-openssl=../openssl-1.1.1i --prefix=/usr/local/nginx --with-pcre=../pcre-8.44 --with-zlib=../zlib-1.2.11 --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-mail=dynamic --with-mail_ssl_module --user=root --group=root --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-perl_modules_path=../perl-5.32.1
make && make install
cd /usr/local/nginx
#
./configure: error: the HTTP XSLT module requires the libxml2/libxslt ## 缺少libxslt库
.//configure: error: the HTTP image filter module requires the GD library. You can either do not enable the module or install the libraries ##缺少gd库
。/configure: error: the GeoIP module requires the GeoIP library #缺少GeoIP库
#
PHP编译
yum install libgd-dev bzip2 bzip2-devel libcurl-devel oniguruma-devel libjpeg
wget https:
wget https:
wget https:
tar -zxvf php-8.0.1.tar.gz
tar -zxvf sqlite-snapshot-202101181235.tar.gz
cd sqlite-snapshot-202101181235
./configure --prefix=/usr/local/sqlite && make install
cd ../php-8.0.1
./configure --prefix=/usr/local/nginx/php --enable-embed=static --enable-fpm --with-fpm-user=root --with-fpm-group=root --enable-litespeed --enable-gcov --enable-zts --enable-rtld-now --enable-sigchild --enable-werror --with-openssl=static,/usr/local/openssl --with-curl --with-freetype --enable-gd --with-gettext --with-iconv --with-kerberos --with-libdir=lib64 --with-mysqli --with-pdo-mysql --with-pdo-sqlite --with-pear --with-jpeg --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml SQLITE_CFLAGS=/usr/local/sqlite/include SQLITE_LIBS=/usr/local/sqlite/lib CFLASG=-lsqlite3
missing initializer for field ‘flags’ of ‘gdFTStringExtra’ [-Werror=missing-field-initializers
修改相对位置的初始化操作,不对变量做初始化
出现undefined reference to libzip之类的错误,需要
all warnings being treated as errors
make CFLAGS="... -Wno-error"