天天看点

Centos6安装Tengine+Lua

添加epel源

<code>rpm -ivh http:</code><code>//dl</code><code>.fedoraproject.org</code><code>/pub/epel/6/x86_64/epel-release-6-8</code><code>.noarch.rpm</code>

<code>yum </code><code>install</code> <code>readline readline-devel zlib zlib-devel</code>

下面安装 lua

<code>tar</code> <code>xvf LuaJIT-2.0.3.</code><code>tar</code><code>.gz</code>

<code>cd</code> <code>LuaJIT-2.0.3/                                                                                            </code>

<code>make</code>

<code>make</code> <code>install</code>

<code>ln</code> <code>-s </code><code>/usr/local/lib/libluajit-5</code><code>.1.so.2 </code><code>/lib64/libluajit-5</code><code>.1.so.2</code>

<code>echo</code>  <code>"export LUAJIT_LIB=/usr/local/lib"</code> <code>&gt;&gt; </code><code>/etc/profile</code>

<code>export</code> <code>"LUAJIT_INC=/usr/local/include/luajit-2.0/"</code> <code>&gt;&gt; </code><code>/etc/profile</code>

编译openssl

<code>wget http:</code><code>//www</code><code>.openssl.org</code><code>/source/openssl-1</code><code>.0.1g.</code><code>tar</code><code>.gz</code>

<code>tar</code> <code>zxf openssl-1.0.1g.</code><code>tar</code><code>.gz</code>

<code>cd</code> <code>openssl-1.0.1g</code>

<code>.</code><code>/config</code> <code>shared zlib</code>

<code>make</code> <code>&amp;&amp; </code><code>make</code> <code>install</code>

 接下来就可以编译 tengine 了

<code>yum </code><code>install</code> <code>-y pcre-devel pcre libxml2 libxml2-devel libxslt-devel gd-devel geoip geoip-devel</code>

<code>cd</code> <code>tengine-2.1.2</code>

<code>.</code><code>/configure</code> <code>--with-cc-opt=</code><code>'-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2'</code> <code>--prefix=</code><code>/usr/share/nginx</code> <code>--conf-path=</code><code>/etc/nginx/nginx</code><code>.conf --http-log-path=</code><code>/var/log/nginx/access</code><code>.log --error-log-path=</code><code>/var/log/nginx/error</code><code>.log --lock-path=</code><code>/var/lock/nginx</code><code>.lock --pid-path=</code><code>/run/nginx</code><code>.pid --http-client-body-temp-path=</code><code>/var/lib/nginx/body</code> <code>--http-fastcgi-temp-path=</code><code>/var/lib/nginx/fastcgi</code> <code>--http-proxy-temp-path=</code><code>/var/lib/nginx/proxy</code> <code>--http-scgi-temp-path=</code><code>/var/lib/nginx/scgi</code> <code>--http-uwsgi-temp-path=</code><code>/var/lib/nginx/uwsgi</code> <code>--with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module  --with-http_sub_module --with-http_xslt_module --with-http_concat_module --with-http_lua_module --with-luajit-lib=</code><code>/usr/local/lib/</code> <code>--with-luajit-inc=</code><code>/usr/local/include/luajit-2</code><code>.0/ --with-lua-inc=</code><code>/usr/local/include/luajit-2</code><code>.0/ --with-lua-lib=</code><code>/usr/local/lib/</code> <code>--with-ld-opt=-Wl,-rpath,</code><code>/usr/local/lib</code> <code>--with-openssl=</code><code>/root/openssl-1</code><code>.0.1g</code>

<code>cp</code> <code>/usr/share/nginx/sbin/nginx</code> <code>/usr/sbin/nginx</code>

测试:修改/etc/nginx/nginx.conf

location /lua_content {

            default_type 'text/plain';

            content_by_lua "ngx.say('Hello,world!')";

        }

浏览器访问 http://x.x.x.x/lua_content

本文转自 转身撞墙角 51CTO博客,原文链接:http://blog.51cto.com/chentianwang/1969991

继续阅读