nginx-1.21.0源碼編譯安裝

 閱讀大約需要1分鐘

首先在nginx官網下載nginx源碼,下載地址:http://nginx.org/en/download.html

新建文件夾 mkdir source

cd source

下載源碼wget http://nginx.org/download/nginx-1.21.0.tar.gz

解壓源碼文件tar -xzvf nginx-1.21.0.tar.gz

cd nginx-1.21.0

在debian10系統下,要安裝好編譯nginx需要的依賴

apt install gcc make

【正則表達式庫】 官網http://www.pcre.org/

apt install libpcre3 libpcre3-dev

[openssl庫]官網https://www.openssl.org/

apt install openssl libssl-dev

apt install zlib1g-dev

nginx編譯參數如下: ./configure --prefix=/home/john/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run /nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-mail --with-mail_ssl_module --with-cc -opt=-O2

make

sudo make install

sudo useradd -s /sbin/nologin -M nginx

sudo certbot --nginx -d yingzhou.online -d www.yingzhou.online