手动安装Nginx

摘要:
1234M目录/温度;cd/温度;wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gztarzxvfpcre-8.39.tar.gzpcre的源代码路径是/temp/pcre-8.397。/usr/local/pcre-8.99的安装路径在上一步中获得。接下来,让我们关注新编译的nginx——使用pcre=[Shell]纯文本来查看复制的代码?1进行安装下一步,转到/usr/local/nginx mytest。安装成功

本分类下有一个环境一键安装.那这背后发生了什么呢?咱们手动使用源码进行安装.
1.首先保证有一个能联网的centos.
2.百度 ningx 官网   点download  http://nginx.org/en/download.html  找到最新版的nginx下载地址. 发贴时最新的是1.12 http://nginx.org/download/nginx-1.12.0.tar.gz
3.进行centos  执行命令   

[Shell] 纯文本查看 复制代码
1
2
3
4
#安装wget
yum installwget -y
#安装gcc和c++编译器
yum installgcc gcc-c++ -y


4.新建临时目录  /temp  然后下载并解压. 命令如下

[Shell] 纯文本查看 复制代码
1
2
3
4
5
mkdir/temp;
cd/temp;
wget http://nginx.org/download/nginx-1.12.0.tar.gz
tarzxvf ./nginx-1.12.0.tar.gz
cd/temp/nginx-1.12.0


得到目录 

[root@localhost nginx-1.12.0]# pwd
/temp/nginx-1.12.0
[root@localhost nginx-1.12.0]# ll
total 724
drwxr-xr-x. 6 1001 1001   4096 Apr 17 11:42 auto
-rw-r--r--. 1 1001 1001 277049 Apr 12 22:46 CHANGES
-rw-r--r--. 1 1001 1001 421985 Apr 12 22:46 CHANGES.ru
drwxr-xr-x. 2 1001 1001   4096 Apr 17 11:42 conf
-rwxr-xr-x. 1 1001 1001   2481 Apr 12 22:46 configure
drwxr-xr-x. 4 1001 1001   4096 Apr 17 11:42 contrib
drwxr-xr-x. 2 1001 1001   4096 Apr 17 11:42 html
-rw-r--r--. 1 1001 1001   1397 Apr 12 22:46 LICENSE
drwxr-xr-x. 2 1001 1001   4096 Apr 17 11:42 man
-rw-r--r--. 1 1001 1001     49 Apr 12 22:46 README
drwxr-xr-x. 9 1001 1001   4096 Apr 17 11:42 src


5.linux三大安装步骤   配置,编译,安装  第一步,配置
--prefix=/安装后的路径  注意这基本是所有安装程序的通用的配置属性
输入命令

[Shell] 纯文本查看 复制代码
1
./configure--prefix=/usr/local/nginx-mytest



接下来会报错 如下

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.


咱们需要安装一个这样的环境对能继续 . 根据上面的意思.咱们先安装 pcre 再指定路径 指定方法在上面就是 --with-pcre=<path>
6.安装pcre.百度这个词得到官网. 然后找到下载路径如下
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/  这里面有一些列表.咱们找到最新的即可 . 目前是 
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz下载,解压,编译

[Shell] 纯文本查看 复制代码
1
2
3
4
mkdir/temp;
cd/temp;
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
tarzxvf pcre-8.39.tar.gz

到此得到了pcre的源码路径 为/temp/pcre-8.39
7.上一步得到安装路径/usr/local/pcre-8.39  接下来咱们从新编译 nginx 注意别忘记  --with-pcre=<path>

[Shell] 纯文本查看 复制代码
1
2
cd/temp/nginx-1.12.0
./configure--prefix=/usr/local/nginx-mytest   --with-pcre=/temp/pcre-8.39



发现完成
第二个命令就是 make   也就是编译, 一般可以跟第三步一起执行,第三步是make install  .所以我们得到命令

[Shell] 纯文本查看 复制代码
1
make&& makeinstall



接下来去/usr/local/nginx-mytest看看吧.安装成功了

免责声明:文章转载自《手动安装Nginx》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇VSCode搭建node + typescript开发环境python轻量级orm框架 peewee常用功能速查下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

[JavaScript] Nginx实现跨域设置

假如跨域请求的接口为:http://xxx.cn/was5/web/search Nginx配置: 在conf/nginx.conf文件中 location /{ root html; index index.html index.htm; } 后面增加 location /was5{ proxy_pass http://...

client intended to send too large body

2012/11/14 19:15:20 [error] 16038#0: *1281 client intended to send too large body: 1797176 bytes, client: 10.96.54.125, server: localhost, request: "PUT /svn/repos/!svn/txr/44-1i/...

NGINX优化参数

(1)nginx运行工作进程个数,一般设置cpu的核心或者核心数x2 如果不了解cpu的核数,可以top命令之后按1看出来,也可以查看/proc/cpuinfo文件 grep ^processor /proc/cpuinfo | wc -l  [root@lx~]# vi/usr/local/nginx1.10/conf/nginx.conf worker...

nginx server 实时监控

本文建立在Centos基础上,也可应用在其他版本的linux上。适合使用nginx为反向代理的java开发人员。写本文的原因是nginx在apache下面也有 一些监控的工具,不过大部分都是基于php的。java开发者可能不愿意再去配置php环境的apache,本文提供了一种简易专业的nginx监控方 法,比较适合小型应用(server number&l...

docker 部署nginx、php-fpm

假设机器上已经安装好docker环境 一.运行nginx容器 1.查找Docker Hub 上的nginx 镜像 runoob@runoob:~/nginx$ docker search nginx NAME DESCRIPTION STARS...

生产环境中使用Docker Swarm的一些建议

译者按: 实践中会发现,生产环境中使用单个Docker节点是远远不够的,搭建Docker集群势在必行。然而,面对Kubernetes, Mesos以及Swarm等众多容器集群系统,我们该如何选择呢?它们之中,Swarm是Docker原生的,同时也是最简单,最易学,最节省资源的,至少值得我们多了解一下。本文将介绍一些非常实用的建议。 原文: Tips for...