1、下载openresty,http://openresty.org/cn/download.html
2、执行安装,官网有指导安装文档,不过会有些要求他是没有说出来的。官网地址:http://openresty.org/cn/installation.html
3、安装前有些东西是要准备的: perl 5.6.1+
, libreadline
, libpcre
, libssl
。我的做法是先编码安装,再看看缺少什么就安装什么吧。请注意有一个坑 ,当你安装pcre的时候,就直接下载源代码吧,别想着去先卸载它再去安装新的版本,因为他会让你死得很惨,太多的命令与pcre有关联了。如果你是云服务器,当卸载了pcre这个组件后就不能连接咯,我就这样被一SB坑过一回(坑点-->http://jingyan.baidu.com/article/f7ff0bfc6bc0472e26bb13bf.html)。他太牛B 没有告诉你先下载需要安装的包,而是先告诉咱先卸载~~~~~,然后就没有然后了,因为什么都做不了咯。重启我的去服务器后系统无法初始化。
3.1 安装pcre
yum install pcre-devel.x86_64
3.2 安装openssl
yum install openssl-devel.x86_64
3.3编译nginx
./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module
4、启动、关闭
启动:/opt/openresty/nginx/sbin/nginx 关闭:/opt/openresty/nginx/sbin/nginx -s stop
5、添加模块,concat模块
svn checkout http://code.taobao.org/svn/nginx_concat_module/trunk/ $NGINX_CONCAT_MODULE
下载后我将下载到的trunk名改成了ngx-concat-module.
5.1 如果没有安装svn:用yum安装后再执行下载
yum install -y subversion
5.2 修改下载后的文件,ngx_http_concat_module.c ,让他支付js合并
查看我另外一篇:http://my.oschina.net/u/2553994/blog/605596
5.3、去到源文件下面执行此命令
./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module --add-module=/opt/openresty/add_module/ngx-concat-module
5.4、再次安装:
gmake install
6、测试吧,启动nginx,如果你在虚拟机,就去开通一下端口的权限,或是直接关闭防火墙,让局域网能访问到你。如下命令
service iptables stop
好了,第一步java环境就算是完成了,后面接着写如何转发不同域名的请求至对应的 web服务器处理。