[导入]安装Nginx,最近在研究这个,鄙视用F5的

一、) 安装Nginx
1.) 安装
Nginx发音为[engine x],是由俄罗斯人Igor Sysoev建立的项目,基于BSD许可。据说他当初是F5的成员之一,英文主页:http://nginx.net。俄罗斯的一些大网站已经使用它超过两年多了,一直表现不凡。
Nginx的编译参数如下:
[root@localhost]#./configure --prefix=/usr/local/server/nginx --with-openssl=/usr/include \
--with-pcre=/usr/include/pcre/ --with-http_stub_status_module --without-http_memcached_module \
--without-http_fastcgi_module --without-http_rewrite_module --without-http_map_module \
--without-http_geo_module --without-http_autoindex_module

在这里,需要说明一下,由于Nginx的配置文件中我想用到正则,所以需要 pcre 模块的支持。我已经安装了 pcre 及 pcre-devel 的rpm包,但是 Ngxin 并不能正确找到 .h/.so/.a/.la 文件,因此我稍微变通了一下:

[root@localhost]#mkdir /usr/include/pcre/.libs/
[root@localhost]#cp /usr/lib/libpcre.a /usr/include/pcre/.libs/libpcre.a
[root@localhost]#cp /usr/lib/libpcre.a /usr/include/pcre/.libs/libpcre.la

然后,修改 objs/Makefile 大概在908行的位置上,注释掉以下内容:

./configure --disable-shared

接下来,就可以正常执行 make 及 make install 了。

2.) 修改配置文件 /usr/local/server/nginx/conf/nginx.conf
以下是我的 nginx.conf 内容,仅供参考:

#运行用户
user nobody nobody;

#启动进程
worker_processes 2;

#全局错误日志及PID文件
error_log logs/error.log notice;
pid logs/nginx.pid;

#工作模式及连接数上限
events {
use epoll;
worker_connections 1024;
}


文章来源:http://www.w3cool.com/2007/12/16/nginxf5.html
原文地址:https://www.cnblogs.com/weijie/p/1348762.html