使用nginx lua velocity的网站架构(转)

本架构目前只支持linux,最好是64位linux,比如fedora19

安装系统所需web软件

1.下载luajit,官网 http://luajit.org/
    wget http://luajit.org/download/LuaJIT-2.0.1.tar.gz
    tar xzvf LuaJIT-2.0.1.tar.gz
    cd LuaJIT-2.0.1
     make PREFIX=/usr/local/web/LuaJIT-2.0.1
     make install PREFIX=/usr/local/web/LuaJIT-2.0.1

2.下载最新版tengine,官网 http://tengine.taobao.org/
     wget http://tengine.taobao.org/download/tengine-1.5.2.tar.gz
     tar xzvf tengine-1.5.2.tar.gz
    cd tengine-1.5.2
    ./configuire --with-ld-opt="-Wl,-rpath,/usr/local/web/LuaJIT-2.0.1/lib" \
    --prefix=/usr/local/web/tengine-1.5.2 --with-http_lua_module \
    --with-luajit-inc=/usr/local/web/LuaJIT-2.0.1/include/luajit-2.0 
    --with-luajit-lib=/usr/local/web/LuaJIT-2.0.1/lib
    make -j2
    make install -j2
    ln -s tengine-1.5.2 nginx

    luajit和tengine默认都安装到/usr/local/web/下
    编译安装tengine时可能会提示以下软件开发包需要安装,我们可以事先使用yum安装编译tengine时必须的软件
    yum install pcre-devel
    yum install openssl-devel
    yum install readline-devel
    因为软件依赖关系复杂,我们这里不描述使用非yum方式安装的情况。
    一般情况下/usr/local/web/nginx/sbin/nginx文件即为可运行的nginx了。


安装业务运行时lua+velocity

1.下载运行时lua环境,运行时代码

    cd /home/admin
    mkdir work
    git clone [email protected]:/nlv_example
    采用git子模块建立的项目,这里下载出各个子模块
    cd nlv_example
    git submodule init
    git submodule update
    make clean
    make
    make install

2.下载运行时所需web模板
    cd /home/admin/work
    git clone [email protected]:/example1_templates example1

启动我的web
    使用root账号运行
    启动:/usr/local/nginx/sbin/nginx -p /home/admin/work/ -c conf/nginx.conf
    关闭:/usr/local/nginx/sbin/nginx -p /home/admin/work/ -c conf/nginx.conf -s stop

    也可以使用admin账号来运行,这里不详细讲了,自己google一下吧

末了,欢迎各位试用,欢迎试用后拍砖。本架构应该是适合嵌入式极小web环境的,譬如路由器等。

猜你喜欢

转载自soledede.iteye.com/blog/1984287
今日推荐