参考:

参考:

Centos 七 nginx-1.1贰.0编写翻译安装,centosnginx-一.12.0

参考:
也不知情作者的种类是还是不是有这一个依赖包,试试啊?贫乏什么小编就装什么呢,多踏点坑总是能学到点东西的.
  获取nginx包 configure
–sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid   报错 ./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包 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
安装pcre cd /usr/local/src wget
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.叁七.tar.gz
tar -zxvf pcre-8.叁7.tar.gz cd pcre-八.3四 ./configure
–prefix=/usr/local/pcre make make install   报错 configure: error: You
need a C++ compiler for C++ support.     安装gcc yum install gcc gcc-c++
再一次安装pcre,成功安装pcre   重新安装nginx   ./configure
–sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid 报错 ./configure: error: the HTTP
gzip module requires the zlib library. You can either disable the module
by using –without-http_gzip_module option, or install the zlib
library into the system, or build the zlib library statically from the
source with nginx by using –with-zlib=<path> option.   安装zlib
获取zlib包
[[email protected]
src]# tar -zxvf zlib-1.2.1壹.tar.gz cd zlib-一.二.1一 ./configure
–prefix=/usr/local/zlib make && make install   重新安装nginx
./configure –sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid   make && make install   运营
[[email protected]
nginx]# systemctl start nginx Failed to start nginx.service: Unit
nginx.service failed to load: No such file or directory. 表明安装失败  
是或不是从未有过安装ssl呢,小编查到系统是有安装的,不放心自身就再安装一回吧.
./config –prefix=/usr/local –openssldir=/usr/local/ssl make && make
install ./config shared –prefix=/usr/local –openssldir=/usr/local/ssl
make clean make && make install   看来还是照着教程安装才算可信赖 删除zlib
pcre 到相应目录运转 make uninstall   安装pcre cd /usr/local/src wget
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.三柒.tar.gz
tar -zxvf pcre-8.叁柒.tar.gz cd pcre-八.3四 ./configure
–prefix=/usr/local/pcre make make install   安装zlib 获取zlib包

[[email protected]
src]# tar -zxvf zlib-一.二.11.tar.gz cd zlib-一.2.11 ./configure
–prefix=/usr/local/zlib make && make install   重新安装nginx
./configure –sbin-path=/usr/local/nginx/nginx \
–conf-path=/usr/local/nginx/nginx.conf \
–pid-path=/usr/local/nginx/nginx.pid \ –with-http_ssl_module
\
–with-pcre=/usr/local/src/pcre-8.40 \
–with-zlib=/usr/local/src/zlib-1.2.11 \
–with-openssl=/usr/local/src/openssl-1.0.2l  
[[email protected]
nginx-1.12.0]# ./configure –sbin-path=/usr/local/nginx/nginx \ >
–conf-path=/usr/local/nginx/nginx.conf \ >
–pid-path=/usr/local/nginx/nginx.pid \ local/src/openssl-1.0.2l>
–with-http_ssl_module \ > –with-pcre=/usr/local/src/pcre-8.40 \
> –with-zlib=/usr/local/src/zlib-1.2.11 \0编写翻译安装。 >
–with-openssl=/usr/local/src/openssl-1.0.2l    
[[email protected]
nginx-1.12.0]# make && make install   修改/etc/local/nginx/nginx.conf
将lisent商品80改为8080 运转服务:/etc/local/nginx/nginx  
访问:   Welcome to nginx!   If you see this
page, the nginx web server is successfully installed and working.
Further configuration is required.   For online documentation and
support please refer to nginx.org. Commercial support is available at
nginx.com.   Thank you for using nginx.     运转nginx服务 方法一:
/usr/local/nginx/nginx 方法2(-c nginx配置文件地方):
/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf   甘休nginx服务
方法壹:从容甘休 查看进程
[[email protected]
nginx]# ps -ef | grep nginx root 620二四 壹 0 07:0壹 ? 00:00:00 nginx:
master process /usr/local/nginx/nginx nobody 620二伍 620二四 0 07:01 ?
00:00:00 nginx: worker process root 6230八 18453 0 07:1四 pts/一 00:00:00
grep –color=auto nginx 杀死进度
[[email protected]
nginx]# kill -QUIT 620二4   方法2:连忙停止 查看进度
[[email protected]
nginx]# ps -ef | grep nginx root 6235八 1 0 0柒:一七 ? 00:00:00 nginx:
master process /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf
nobody 62359 62358 0 07:17 ? 00:00:00 nginx: worker process root 62463
1捌四五叁 0 0七:20 pts/1 00:00:00 grep –color=auto nginx 杀死进度
[[email protected]
nginx]# kill -TERM 62358 或者
[[email protected]
nginx]# /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf
[[email protected]
nginx]# ps -ef | grep nginx root 62473 1 0 07:21 ? 00:00:00 nginx:
master process /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf
nobody 62474 62473 0 07:21 ? 00:00:00 nginx: worker process root 62476
18453 0 07:21 pts/1 00:00:00 grep –color=auto nginx
[[email protected]
nginx]# kill -INT 6247叁   方法三:强制结束
[[email protected]
nginx]# pkill -玖 nginx   感觉那么些最棒记有未有?
前天简单安装就到那边,后天学一下配置. 

7 nginx-一.1二.0编写翻译安装,centosnginx-一.1二.0
参考:…

nginx安装

也不晓得小编的连串是或不是有那么些注重包,试试吧?紧缺什么我就装什么样呢,多踏点坑总是能学到点东西的.

也不亮堂小编的系统是否有那一个正视包,试试啊?缺乏什么笔者就装什么样呢,多踏点坑总是能学到点东西的.

nginx能够动用各平台的默许包来安装,本文是介绍使用源码编写翻译安装,包罗实际的编译参数消息。

 

 

行业内部开班前,编写翻译环境gcc g++
开发库之类的要求提前装好,这里暗中认可你曾经装好。

获取nginx包

获取nginx包

centos平台编写翻译环境使用如下指令

安装make:

configure –sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid

configure –sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid

 

 

 

yum -y install gcc automake autoconf libtool make

报错

报错

 

./configure: error: the HTTP rewrite module requires the PCRE library.

./configure: error: the HTTP rewrite module requires the PCRE library.

安装g++:

You can either disable the module by using
–without-http_rewrite_module

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

option, or install the PCRE library into the system, or build the PCRE
library

yum install gcc gcc-c++

statically from the source with nginx by using –with-pcre=<path>
option

statically from the source with nginx by using –with-pcre=<path>
option

 

 

 

上边正式开首:

 

 

相似我们都亟需先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。

获取pcre包

获取pcre包

 

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

注:上面所使用的保有版本均为了却201七年6月1肆号,最新版本
一.选定源码目录
能够是其余目录,本文选定的是/usr/local/src

安装pcre

安装pcre

 

cd /usr/local/src

cd /usr/local/src

cd /usr/local/src

wget
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

wget
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

 

tar -zxvf pcre-8.37.tar.gz

tar -zxvf pcre-8.37.tar.gz

2.安装PCRE库
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载最新的 PCRE
源码包,使用上面发号施令下载编写翻译和装置 PCRE 包:

cd pcre-8.34

cd pcre-8.34

 

./configure –prefix=/usr/local/pcre

./configure –prefix=/usr/local/pcre

cd /usr/local/src

make

make

wget
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz

make install

make install

tar -zxvf pcre-8.41.tar.gz

 

 

cd pcre-8.41

报错

报错

./configure

configure: error: You need a C++ compiler for C++ support.

configure: error: You need a C++ compiler for C++ support.

make

 

 

make install

 

 

 

安装gcc

安装gcc

 

yum install gcc gcc-c++

yum install gcc gcc-c++

3.安装zlib库
 下载最新的 zlib
源码包,使用下边发号施令下载编译和设置 zlib包:

双重安装pcre,成功安装pcre

再度安装pcre,成功安装pcre

 

 

 

 

cd /usr/local/src

wget http://zlib.net/zlib-1.2.11.tar.gz

tar -zxvf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./configure

make

make install

 

重新安装nginx

重新安装nginx

四.设置ssl(某个vps私下认可没装ssl)

 

 

 

./configure –sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid

./configure –sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid

cd /usr/local/src

报错

报错

wget

./configure: error: the HTTP gzip module requires the zlib library.

./configure: error: the HTTP gzip module requires the zlib library.

tar -zxvf openssl-1.0.2l.tar.gz

You can either disable the module by using –without-http_gzip_module

You can either disable the module by using –without-http_gzip_module

 

option, or install the zlib library into the system, or build the zlib
library

option, or install the zlib library into the system, or build the zlib
library

5.安装nginx

statically from the source with nginx by using –with-zlib=<path>
option.

statically from the source with nginx by using –with-zlib=<path>
option.

Nginx
壹般有七个本子,分别是稳定版和开发版,您能够依照你的目标来选用那两个本子的中间3个,上边是把
Nginx 安装到 /usr/local/nginx 目录下的详实步骤:

 

 

 

安装zlib

安装zlib

cd /usr/local/src

获取zlib包

获取zlib包

wget

tar -zxvf nginx-1.13.4.tar.gz

[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz

[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz

cd nginx-1.13.4

cd zlib-1.2.11

cd zlib-1.2.11

 

./configure –prefix=/usr/local/zlib

./configure –prefix=/usr/local/zlib

./configure –sbin-path=/usr/local/nginx/nginx \

make && make install

make && make install

–conf-path=/usr/local/nginx/nginx.conf \

 

 

–pid-path=/usr/local/nginx/nginx.pid \

重新安装nginx

重新安装nginx

–with-http_ssl_module \

./configure –sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid

./configure –sbin-path=/user/local/nginx/nginx
–conf-path=/usr/local/nginx/nginx.conf
–pid-path=/usr/local/nginx/nginx.pid

–with-pcre=/usr/local/src/pcre-8.41 \

 

 

–with-zlib=/usr/local/src/zlib-1.2.11 \

make && make install

make && make install

–with-openssl=/usr/local/src/openssl-1.0.2l

 

 

 

启动

启动

make

[root@bogon nginx]# systemctl start nginx

[root@bogon nginx]# systemctl start nginx

make install

Failed to start nginx.service: Unit nginx.service failed to load: No
such file or directory.

Failed to start nginx.service: Unit nginx.service failed to load: No
such file or directory.

 

评释安装失利

证实安装退步

–with-pcre=/usr/local/src/pcre-8.四壹 指的是pcre-八.四一 的源码路径。
–with-zlib=/usr/local/src/zlib-壹.二.1壹 指的是zlib-一.二.1一 的源码路径。

 

 

 

是还是不是尚未设置ssl呢,笔者查到系统是有安装的,不放心自身就再设置2次吧.

是或不是不曾安装ssl呢,作者查到系统是有安装的,不放心自个儿就再安装1遍吧.

设置成功:

./config –prefix=/usr/local –openssldir=/usr/local/ssl

./config –prefix=/usr/local –openssldir=/usr/local/ssl

安装成功后 /usr/local/nginx 会有此目录

make && make install

make && make install

 

./config shared –prefix=/usr/local –openssldir=/usr/local/ssl

./config shared –prefix=/usr/local –openssldir=/usr/local/ssl

 

make clean

make clean

6.启动
管教系统的 80 端口没被此外程序占用,运转/usr/local/nginx/nginx
命令来运转 Nginx,

make && make install

make && make install

 

 

 

开辟浏览器访问此机器的 IP,尽管浏览器出现 Welcome to nginx! 则意味 Nginx
已经设置并运转成功。

总的看依然照着教程安装才算可信

总的来说仍旧照着教程安装才算可相信

 

删除zlib pcre

删除zlib pcre


到相应目录运营 make uninstall

到相应目录运营 make uninstall

到那边nginx就设置到位了,假如只是处理静态html就不用继续设置了

 

 

假如您须要处理php脚本的话,还亟需安装php-fpm。

安装pcre

安装pcre

 

cd /usr/local/src

cd /usr/local/src

 

wget
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

wget
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

广阔错误:

tar -zxvf pcre-8.37.tar.gz

tar -zxvf pcre-8.37.tar.gz

附:恐怕遇到的荒谬和壹些帮扶音信

cd pcre-8.34

cd pcre-8.34

1.1编译pcre错误

./configure –prefix=/usr/local/pcre

./configure –prefix=/usr/local/pcre

 

make

make

make[1]: Leaving directory `/usr/local/src/pcre-8.34′

make install

make install

make: *** [all] Error 2

 

 

 

安装zlib

安装zlib

消除办法:安装g++,别忘了重新configure

获取zlib包

获取zlib包

 

apt-get install g++

[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz

[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz

apt-get install build-essential

cd zlib-1.2.11

cd zlib-1.2.11

make clean

./configure –prefix=/usr/local/zlib

./configure –prefix=/usr/local/zlib

./configure

make && make install

make && make install

make

 

 

 

重新安装nginx

重新安装nginx

 

./configure
–sbin-path=/usr/local/nginx/nginx \

./configure
–sbin-path=/usr/local/nginx/nginx \

1.2 make出错

–conf-path=/usr/local/nginx/nginx.conf
\

–conf-path=/usr/local/nginx/nginx.conf
\

 

–pid-path=/usr/local/nginx/nginx.pid
\

–pid-path=/usr/local/nginx/nginx.pid
\

make: *** No targets specified and no makefile found.  Stop.

–with-http_ssl_module \

–with-http_ssl_module \

 

–with-pcre=/usr/local/src/pcre-8.40
\

–with-pcre=/usr/local/src/pcre-8.40
\

依照上面设置情势

–with-zlib=/usr/local/src/zlib-1.2.11
\

–with-zlib=/usr/local/src/zlib-1.2.11
\

yum -y install openssl openssl-devel

–with-openssl=/usr/local/src/openssl-1.0.2l

–with-openssl=/usr/local/src/openssl-1.0.2l

二.nginx编写翻译选项(上面代码必须在一行)

 

 

 

[root@bogon nginx-1.12.0]# ./configure
–sbin-path=/usr/local/nginx/nginx \

[root@bogon nginx-1.12.0]# ./configure
–sbin-path=/usr/local/nginx/nginx \

./configure –sbin-path=/usr/local/nginx/nginx \

> –conf-path=/usr/local/nginx/nginx.conf \

> –conf-path=/usr/local/nginx/nginx.conf \

–conf-path=/usr/local/nginx/nginx.conf \

> –pid-path=/usr/local/nginx/nginx.pid \

> –pid-path=/usr/local/nginx/nginx.pid \

–pid-path=/usr/local/nginx/nginx.pid \

local/src/openssl-1.0.2l> –with-http_ssl_module \

local/src/openssl-1.0.2l> –with-http_ssl_module \

–with-http_ssl_module \

> –with-pcre=/usr/local/src/pcre-8.40 \

> –with-pcre=/usr/local/src/pcre-8.40 \

–with-pcre=/usr/local/src/pcre-8.41 \

> –with-zlib=/usr/local/src/zlib-1.2.11 \

> –with-zlib=/usr/local/src/zlib-1.2.11 \

–with-zlib=/usr/local/src/zlib-1.2.11 \

> –with-openssl=/usr/local/src/openssl-1.0.2l

> –with-openssl=/usr/local/src/openssl-1.0.2l

–with-openssl=/usr/local/src/openssl-1.0.2l

 

 

 

 

[root@bogon nginx-1.12.0]# make && make install

[root@bogon nginx-1.12.0]# make && make install

 

 

修改/etc/local/nginx/nginx.conf 将lisent商品80改为8080

修改/etc/local/nginx/nginx.conf 将lisent商品80改为8080

起步服务:/etc/local/nginx/nginx

运转服务:/etc/local/nginx/nginx

 

 

访问:http://192.168.158.128:8080

访问:http://192.168.158.128:8080

 

 

Welcome to nginx!

Welcome to nginx!

 

 

If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.

If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.

 

 

For online documentation and support please refer to nginx.org.

For online documentation and support please refer to nginx.org.

Commercial support is available at nginx.com.

Commercial support is available at nginx.com.

 

 

Thank you for using nginx.

Thank you for using nginx.

 

 

 

 

启动nginx服务

启动nginx服务

方法一:

方法一:

/usr/local/nginx/nginx

/usr/local/nginx/nginx

格局贰(-c nginx配置文件地方):

办法贰(-c nginx配置文件地方):

/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf

/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf

 

 

停止nginx服务

停止nginx服务

措施壹:从容停止

格局壹:从容甘休

翻看进度

查看进度

[root@bogon nginx]# ps -ef | grep nginx

[root@bogon nginx]# ps -ef | grep nginx

root 62024 1 0 07:01 ? 00:00:00 nginx: master process
/usr/local/nginx/nginx

root 62024 1 0 07:01 ? 00:00:00 nginx: master process
/usr/local/nginx/nginx

nobody 62025 62024 0 07:01 ? 00:00:00 nginx: worker process

nobody 62025 62024 0 07:01 ? 00:00:00 nginx: worker process

root 62308 18453 0 07:14 pts/1 00:00:00 grep –color=auto nginx

root 62308 18453 0 07:14 pts/1 00:00:00 grep –color=auto nginx

干掉进度

杀掉进度

[root@bogon nginx]# kill -QUIT 62024

[root@bogon nginx]# kill -QUIT 62024

 

 

办法2:火速截至

措施2:快速结束

查看过程

翻开进程

[root@bogon nginx]# ps -ef | grep nginx

[root@bogon nginx]# ps -ef | grep nginx

root 62358 1 0 07:17 ? 00:00:00 nginx: master process
/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf

root 62358 1 0 07:17 ? 00:00:00 nginx: master process
/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf

nobody 62359 62358 0 07:17 ? 00:00:00 nginx: worker process

nobody 62359 62358 0 07:17 ? 00:00:00 nginx: worker process

root 62463 18453 0 07:20 pts/1 00:00:00 grep –color=auto nginx

root 62463 18453 0 07:20 pts/1 00:00:00 grep –color=auto nginx

干掉进度

杀死过程

[root@bogon nginx]# kill -TERM 62358

[root@bogon nginx]# kill -TERM 62358

或者

或者

[root@bogon nginx]# /usr/local/nginx/nginx -c
/usr/local/nginx/nginx.conf

[root@bogon nginx]# /usr/local/nginx/nginx -c
/usr/local/nginx/nginx.conf

[root@bogon nginx]# ps -ef | grep nginx

[root@bogon nginx]# ps -ef | grep nginx

root 62473 1 0 07:21 ? 00:00:00 nginx: master process
/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf

root 62473 1 0 07:21 ? 00:00:00 nginx: master process
/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf

nobody 62474 62473 0 07:21 ? 00:00:00 nginx: worker process

nobody 62474 62473 0 07:21 ? 00:00:00 nginx: worker process

root 62476 18453 0 07:21 pts/1 00:00:00 grep –color=auto nginx

root 62476 18453 0 07:21 pts/1 00:00:00 grep –color=auto nginx

[root@bogon nginx]# kill -INT 62473

[root@bogon nginx]#澳门金沙国际 , kill -INT 62473

 

 

艺术三:强制甘休

方法三:强制甘休

[root@bogon nginx]# pkill -9 nginx

[root@bogon nginx]# pkill -9 nginx

 

 

备感那一个最佳记有未有?

觉得那个最佳记有未有?

明天简短安装就到那里,前日学一下配置. 

今天简短安装就到此处,明日学一下配置. 

相关文章