Ubuntu 编译Nginx1.18版本 替换低版本Nginx

July 18, 2020, 12:22 p.m.

read: 1859

安装apt源的低版本的nginx

sudo apt-get install nginx

下载1.18版本的nginx

wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar -zxvf nginx-1.18.0.tar.gz

查看低版本的nginx的编译选项
/usr/sbin/nginx -V

configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

安装依赖

 sudo apt-get install libpcre3 libpcre3-dev
 sudo apt-get install openssl libssl-dev
 sudo apt install zlib1g-dev
 sudo apt-get install libxml2 libxml2-dev libxslt-dev
 # 16.04
     sudo apt-get install libgd2-dev
 # 18.04
     sudo apt-get install libgd-dev
 sudo apt-get install geoip-database libgeoip-dev

设置编译参数并编译

cd nginx-1.18.0
./configure --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads
make

替换默认的nginx

cd objs
sudo mv /usr/sbin/nginx /usr/sbin/nginx_old
sudo cp nginx  /usr/sbin/
sudo cp ngx_*_module.so /usr/share/nginx/modules




ubuntu pip 为django安装 uwsgi 出错

Django部署阶段需要安装uwsgi:https://docs.djangoproject.com/zh-hans/2.2/howto/deployment/wsgi/uwsgi/执行命令安装:p…

R7800 明月固件 简易网盘webd 配置用户名密码

文章标题:R7800 明月固件 简易网盘webd 配置用户名密码文章内容:Step 1尝试界面自动安装Webd,我这尝试失败下面采用手动拷贝链接安装访问 https://webd.cf/latest…

此站点由 ASP.NETIIS 驱动 | © 2018-2023 hupeng.me. All Rights Reserved.