一、下載openresty,http://openresty.org/cn/download.htmlhtml
二、執行安裝,官網有指導安裝文檔,不過會有些要求他是沒有說出來的。官網地址:http://openresty.org/cn/installation.htmljava
三、安裝前有些東西是要準備的: perl 5.6.1+
, libreadline
, libpcre
, libssl
。個人作法是先編碼安裝,再看看缺乏什麼就安裝什麼吧。請注意有一個坑 ,當你安裝pcre的時候,就直接下載源代碼吧,別想着去先卸載它再去安裝新的版本,由於他會讓你死得很慘,太多的命令與pcre有關聯了。若是你是雲服務器,當卸載了pcre這個組件後就不能鏈接咯,我就這樣被一SB坑過一回(坑點-->http://jingyan.baidu.com/article/f7ff0bfc6bc0472e26bb13bf.html)。他太牛B 沒有告訴你先下載須要安裝的包,而是先告訴咱先卸載~~~~~,而後就沒有而後了,由於什麼都作不了咯。重啓個人去服務器後系統沒法初始化。nginx
3.1 安裝pcreweb
yum install pcre-devel.x86_64
3.2 安裝opensslredis
yum install openssl-devel.x86_64
3.3編譯nginxshell
./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module
四、啓動、關閉服務器
啓動:/opt/openresty/nginx/sbin/nginx 關閉:/opt/openresty/nginx/sbin/nginx -s stop
五、添加模塊,concat模塊svn
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.三、去到源文件下面執行此命令
./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module --add-module=/opt/openresty/add_module/ngx-concat-module
5.四、再次安裝:
gmake install
六、測試吧,啓動nginx,若是你在虛擬機,就去開通一下端口的權限,或是直接關閉防火牆,讓局域網能訪問到你。以下命令
service iptables stop
好了,第一步java環境就算是完成了,後面接着寫如何轉發不一樣域名的請求至對應的 web服務器處理。