靳闯博客 记录是一种习惯 、分享是一种态度
  • 波浪
  • 波浪
  • 波浪
  • 波浪
ubuntu18.04源码安装nginx1.18.0
发表于: | 分类: 技术积累 | 标签: Linux Nginx ubuntu

ubuntu 18.04下源码编译安装nginx1.18版本

首先是安装依赖包(习惯了centos的话,在ubuntu下安装软件包名是不同的,需要更改安装的包名名称)
安装目录:/usr/local/nginx/
源码包目录:/data/source/


# 安装依赖包
apt install gcc g++ unzip bzip2 zlib1g zlib1g-dev libpcre3 libpcre3-dev openssl \
libssl-dev libgeoip1 libgeoip-dev libgeoip-dev make libtool build-essential libgd-dev -y

# 下载源码包解压
cd /data/source/
wget https://ossjc-1252545319.cos.ap-shanghai.myqcloud.com/other/linux/pcre/pcre-8.44.tar.gz
wget https://ossjc-1252545319.cos.ap-shanghai.myqcloud.com/other/linux/zlib/zlib-1.2.11.tar.gz
wget https://ossjc-1252545319.cos.ap-shanghai.myqcloud.com/other/linux/openssl/openssl-1.1.1f.tar.gz

tar xf pcre-8.44.tar.gz
tar xf zlib-1.2.11.tar.gz
tar xf openssl-1.1.1f.tar.gz

安装nginx

# 创建运行用户
useradd -M -s /sbin/nologin

# 下载源码包
cd /data/source/
wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar xf nginx-1.18.0.tar.gz

cd nginx-1.18.0/
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/usr/local/nginx/client_temp \
--http-proxy-temp-path=/usr/local/nginx/proxy_temp \
--http-fastcgi-temp-path=/usr/local/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/usr/local/nginx/uwsgi_temp \
--http-scgi-temp-path=/usr/local/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-mail \
--with-stream \
--with-threads \
--with-file-aio \
--with-poll_module \
--with-select_module \
--with-http_v2_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_ssl_module \
--with-http_geoip_module \
--with-http_slice_module \
--with-http_gunzip_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_image_filter_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-mail_ssl_module \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_ssl_preread_module \
--with-pcre=/data/source/pcre-8.44 \
--with-openssl=/data/source/openssl-1.1.1f \
--with-zlib=/data/source/zlib-1.2.11

# 编译/安装(编译时间稍长,慢慢等待)
make && make install

#配置环境变量
echo 'export PATH=$PATH:/usr/local/nginx/sbin' >> /etc/profile && source /etc/profile

启动nginx

# 验证nginx
nginx -V

# 启动
nginx

# 查看端口
netstat -lntp

nginx

类似博文:

centos7 源码安装nginx 1.14


商业转载请联系作者获得授权,非商业转载请注明出处 本文地址:https://me.jinchuang.org/archives/941.html

如果这篇文章帮助到了你,我感到十分荣幸!


广告:

📬 评论留言

icon_mrgreen.pngicon_neutral.pngicon_twisted.pngicon_arrow.pngicon_eek.pngicon_smile.pngicon_confused.pngicon_cool.pngicon_evil.pngicon_biggrin.pngicon_idea.pngicon_redface.pngicon_razz.pngicon_rolleyes.pngicon_wink.pngicon_cry.pngicon_surprised.pngicon_lol.pngicon_mad.pngicon_sad.pngicon_exclaim.pngicon_question.png2018new_aini_org.png2018new_baobao_thumb.png2018new_erha_org.png2018new_kuxiao_thumb.png2018new_yun_thumb.png2018new_hufen_thumb.png2018new_gui_org.png2018new_xiaoerbuyu_org.png2018new_heixian_thumb.png2018new_wabi_thumb.png2018new_tianping_thumb.png

站点地图 网站地图 RSS Feed
豫ICP备17003270号 | Copyright © 2016-2021 靳闯博客
Typecho🍹Sgreen
TOP