这篇文章就是讲若是编译安装,反向代理服务器 之 nginx。nginx
构架篇提到tengine,是淘宝技术团队基于nginx再扩展集成了其余模块后的一个开源产品,此次编译咱们就是基于被阿里打磨过的tengine来作。web
从 http://tengine.taobao.org/, 下载tengine 到 download缓存
cd download
tar -xf tengine-1.5.2.tar.gz
cd tengine-1.5.2
#注释 这里最重要一步就是配置编译项 我一步步解释
./configure \ --with-http_ssl_module \ #提供https支持 --prefix=/usr/local/nginx \ #设定安装路径 --conf-path=/etc/nginx/nginx.conf \ #设定配置文件路径, 启动nginx时默认读取该配置文件 --error-log-path=/var/log/nginx/error.log \ #设定错误日志路径 --http-log-path=/var/log/nginx/access.log \ #设定access日志路径 --pid-path=/var/run/nginx.pid \ #pid路径 --lock-path=/var/lock/nginx.lock \ #lock路径 --user=www \ #默认子进程启动用户 --group=www \ #默认组 --http-client-body-temp-path=/data/nginx_temp/client_body_temp \ #如下是nginx启动后缓存文件存放路径 --http-proxy-temp-path=/data/nginx_temp/proxy_temp \ --http-fastcgi-temp-path=/data/nginx_temp/fastcgi_temp \ --http-uwsgi-temp-path=/data/nginx_temp/uwsgi_temp \ --http-scgi-temp-path=/data/nginx_temp/scgi_temp \ --with-http_stub_status_module \ #打开统计页面 --with-http_gzip_static_module \ #打开响应数据压缩功能 --with-http_lua_module \ #提供lua解析功能 --with-luajit-inc=/usr/local/include/luajit-2.0 \ #设定lua解析器include路径 --with-luajit-lib=/usr/local/lib \ #设定lua解析器lib路径 --with-http_concat_module \ #设定响应文件合并 --with-http_sysguard_module \ #当系统swap到阀值时候,提供响应动做 --with-http_realip_module \ #提供后台响应ip地址篡改 --without-syslog \ --with-jemalloc \ #设定jemalloc模块提供内存管理 --add-module=${NDK_DIR} \ #增长nginx开发模块
#开始编译
make
#开始安装
make install
启动后,咱们能看到子进程的用户是www服务器
[test@web1012 ~]$ ps -ef|grep nginx root 1348 1 0 Feb25 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /etc/nginx/nginx.conf www 7522 1348 0 Mar03 ? 00:01:01 nginx: worker process 912 16556 16457 0 15:28 pts/5 00:00:00 grep --color=auto nginx [test@web1012 ~]$
根据不一样的需求,咱们可能开启不一样模块,具体能够参考nginx 免费版官网(有个收费的), 或是 tengine 官网lua
http://nginx.org/en/docs/spa