音乐分享(自动连播):
So cold
Not my baby
Wicked Game
What Is Love
Once Upon a Time
The Heart Of The Ocean
Sun Goes Down
Move That Body
Lose Control
云山
一趟
记录分享 记录是一种习惯 、分享是一种态度
centos7 源码安装nginx 1.14
· 技术积累 · Linux Nginx

在centos7下面 源码安装nginx 1.14,同样适用于后续版本

创建用户、安装依赖包

#关闭selinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

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

#添加epelyum源
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo

#安装依赖包
yum -y install wget unzip bzip2 zlib zlib-devel pcre pcre-devel \
openssl openssl-devel geoip geoip-devel gd gd-devel  gcc gcc-c++ make libtool  

#包存放目录
mkdir /source && cd /source

#安装配置支持包
wget  https://www.jinchuang.org/novel/lnmp/pcre-8.35.tar.gz
wget  https://www.openssl.org/source/openssl-1.0.2h.tar.gz
wget  https://www.jinchuang.org/novel/lnmp/zlib-1.2.8.tar.gz


#解压
tar xf pcre-8.35.tar.gz
tar xf openssl-1.0.2h.tar.gz
tar xf zlib-1.2.8.tar.gz

下载nginx源码包、解压

wget http://nginx.org/download/nginx-1.14.1.tar.gz
tar xf nginx-1.14.1.tar.gz

配置、编译、安装

cd nginx-1.14.1
#配置:【注意:pcre,openssl,zlib路径填写源码包路径不是编译安装后路径】
./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=/source/pcre-8.35 \
--with-openssl=/source/openssl-1.0.2h \
--with-zlib=/source/zlib-1.2.8

make && make install

设置系统变量

vim /etc/profile
#文件最后添加一行
export PATH=$PATH:/usr/local/nginx/sbin
#重新读取文件
source /etc/profile

或者
echo 'export PATH=$PATH:/usr/local/nginx/sbin' >>/etc/profile && source /etc/profile

启动、访问

[root@localhost ~]# nginx
[root@localhost ~]# netstat -lntp |grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      7945/nginx: master  

welcomenginx.png

ubuntu18.04源码安装nginx1.18.0

本文最后更新时间 2023-05-30
文章链接地址:https://me.jinchuang.org/archives/298.html
本文内容未来会持续更新·本站文章除注明[转载|引用|原文]出处外,均为本站原生内容,转载前请注明出处


留言

顶部