Nginx 可以承受 3 万并发连接数,Apache 默认最大连接数是 256 个。

 

编译安装

① 下载

在 Nginx 的主页 http://nginx.org/ 下载最新的 stable version(稳定版)Nginx 1.8.0(http://nginx.org/en/download.html-http://nginx.org/download/nginx-1.8.0.tar.gz),ftp 传输到 /usr/local/src 目录下(CentOS 6.6)

 

② 解压

tar zxvf nginx-1.8.0.tar.gz 

 

③ 进入目录

cd nginx-1.8.0

 

④ 配置

 ./configure  --prefix=/usr/local/nginx

 

如果报错:

./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 library 是正则表达式库,安装 pcre 包(二进制包):

mount /dev/cdrom /mnt/cdrom #挂载光盘
yum install pcre

 

如果还是报同样的错,可以安装相应的 develop(头文件):

yum install pcre-devel 

 

重新配置:

 ./configure  --prefix=/usr/local/nginx

Nginx 笔记与总结(1)编译安装

没有报错。

 

⑤ 编译、安装

make && make install

Nginx 笔记与总结(1)编译安装

完毕。

 

 

此时在 /usr/local 下能看到 nginx 目录:

Nginx 笔记与总结(1)编译安装

 

进入nginx 目录:

cd nginx
ll

Nginx 笔记与总结(1)编译安装

conf:配置文件目录

html:网页文件目录

logs:日志文件目录

sbin:主要二进制程序

Nginx 笔记与总结(1)编译安装

sbin/nginx:主程序

 

 

启动 Nginx:

[[email protected] sbin]# cd ../
[[email protected] nginx]# ./sbin/nginx 

 

查看 80 端口的使用情况:

netstat -antp

Nginx 笔记与总结(1)编译安装

 

或者

netstat -tunpl | grep 80

Nginx 笔记与总结(1)编译安装

 

相关文章:

  • 2021-12-01
  • 2021-10-08
  • 2021-12-12
  • 2021-05-12
  • 2021-06-03
  • 2021-09-02
  • 2021-05-15
猜你喜欢
  • 2021-07-29
  • 2022-02-05
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-02-08
  • 2021-07-14
相关资源
相似解决方案