nginx 的源码安装

安装nginx之前要做的准备工作有:安装如下库

(1)gzip模块需要 zlib 库

(2)rewrite模块需要 pcre 库

(3)ssl 功能需要openssl库

1~pcre的安装:

我们可以之间yum 安装


yum -y install pcre*

或者源码安装


cd /usr/local/src

wget https://sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.gz/download

tar xf  pcre-8.39.tar.gz

cd pcre-8.39

./configure

make

make install

2~openssl的安装

需要ssl的支持,如果不需要,跳过这一步,


yum   安装

yum -y install openssl*

源码安装

wget   ftp://ftp.openssl.org/source/openssl-1.0.1t.tar.gz

tar xf

cd

./config

make && make install

3.zlib的编译安装:


wget  http://zlib.net/zlib.1.2.8.tar.gz

tar  xf

cd

./configure

make && make install

4~重头戏来了,nginx的编译安装


wget   http://nginx.org/download/nginx-1.10.1.tar.gz

groupadd nginx

useradd nginx -g nginx

tar xf nginx-1.10.1.tar.gz

./configure --prefix=/usr/local/nginx  --user=nginx   --group=nginx --with-http_ssl_module   --with-http_stub_status_module --with-pcre

下面解释一下

--with-pcre:为了支持rewrite重写功能,必须制定pcre

--with-http_stub_status_module:支持nginx状态查询

--with-http_ssl_module:支持https

最后执行:make   && make install

至此nginx  就安装完成了

nginx的启动方式为

cd /usr/local/nginx/sbin/

./nginx -s start |  stop     |       restart    |     reload

时间: 2024-08-30 10:14:52

nginx 的源码安装的相关文章

编译nginx的源码安装subs_filter模块

使用nginx的反向代理功能搭建nuget镜像服务器时,需要针对官方nuget服务器的响应内容进行字符串替换,比如将www.nuget.org替换为镜像服务器的主机名,将https://替换为http://.而nginx没有内置这个功能,需要使用第三方module,比如subs_filter. 在nginx中配置module,不像apache那么简单(复制module文件,修改配置文件),需要将module的源码引入nginx的源码,自己编译nginx并安装. 下面分享一下自己在centos上编

nginx的源码安装部署

Nginx安装:源码安装 添加普通用户账号来运行nginx:useradd nginx -M -r -s /sbin/nologin 安装依赖包yum install -y gcc pcre-devel openssl-devel 解压并安装Nginx:wget http://nginx.org/download/nginx-1.10.3.tar.gztar xvf nginx-1.10.3.tar.gz cd nginx-1.10.3./configure --user=nginx \--gr

【Nginx】源码安装Nginx 平滑升级Nginx

Web服务对比 Linux平台 Php.Python:nginx.tengine(淘宝).apache Jave:tomcat.Jboss.IBM WebSphere Windows平台:IIS(.net) Nginx的优点:性能高.并发高.静态网站.动态网站(php.python) 在对比其他web软件的情况下nginx的性能更加好!在国内广泛使用 Nginx 十分轻量级的HTTP服务器 是一个高性能的HTTP和反向代理服务器 官方网站: http://nginx.org/ Nginx以及现代

nginx使用源码安装

nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息. 正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好. 下面正式开始---------------------------------------------------------------------------一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩.1.选定源码目录可以是任何目录,本文选定的是/usr/local/sr

zabbix,php,nginx,mysql源码安装 神仙操作

→软件包 mkdir /soft/ cd /soft ♦下载以下软件包 nginx-1.14.2.tar.gz wget http://nginx.org/download/nginx-1.14.2.tar.gz  mysql-boost-5.7.25.tar.gz wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.25.tar.gz boost_1_59_0.tar.gz wget https://source

Linux下源码安装nginx服务器以及部分配置

    Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由Igor Sysoev为俄罗斯访问量第二的Rambler.ru站点开发的,第一个公开版本0.1.0发布于2004年10月4日.其将源代码以类BSD许可证的形式发布,因它的稳定性.丰富的功能集.示例配置文件和低系统资源的消耗而闻名.2011年6月1日,nginx 1.0.4发布. Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(

nginx 源码安装openssl修复Heartbleed漏洞

如果你的nginx使用的是动态的openssl库,直接升级openssl,如果你的nginx使用的是静态的openssl库,那就要重新编译安装nginx. PHP编译修复 1. nginx使用的是动态的openssl库,直接升级openssl    1.1 源码安装openssl1.0.1g版本        先下载openssl 1.0.1g版本,命令如下:            #wget  -c    https://www.openssl.org/source/openssl-1.0.1

saltstack 系列(四)centos7使用saltstack源码安装nginx

使用saltstack源码安装nginx,首先先看一下我nginx的目录  tree一下,我们只需要关系nginx-install.sls 和nignx-service.sls.clu-vhost是我用python写的自动添加集群和自动更新踢出集群,后面会讲到. nginx ├── files │   ├── clu-vhost │   │   ├── 11.py │   │   ├── content.txt │   │   ├── epel-release-latest-7.noarch.r

Centos 7.0 编译安装LNMP(Linxu+nginx+mysql+php)之源码安装nginx (一)

nginx简介:       Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,第一个公开版本0.1.0发布于2004年10月4日. 其将源代码以类BSD许可证的形式发布,因它的稳定性.丰富的功能集.示例配置文件和低系统资源的消耗而闻名.2011年6月1日,nginx 1.0.4发布. Nginx是一款轻量级的Web 服务器