Lua nginx openresty configuration
* OS - Centos 6, 64bit
* Dependencies - pcre.x86_64, pcre-devel.x86_64
* With module geoip
Building from source distribution - ngx_openresty-1.2.6.6.tar.tgz , GeoIP-1.4.8.tar.gz
Extract and copy to /opt/
# cd /root/openresty/GeoIP-1.4.8
# ./configure ( if libtool error occure install below)
# make
# make install
# cd /opt/ngx_openresty-1.2.6.6/
# ./configure --with-luajit
# make
# make install
Testing
# mkdir /root/luatest
# cd /root/luatest
# mkdir conf logs
Edit nginx.conf and paste following
#
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
}
#
Start nginx -
# /usr/local/openresty/nginx/sbin/nginx -p /root/luatest -c /root/luatest/conf/nginx.conf
If error comes for lib, execute following and then again start nginx
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
# curl http://127.0.0.1:8080/
Thanks
* OS - Centos 6, 64bit
* Dependencies - pcre.x86_64, pcre-devel.x86_64
* With module geoip
Building from source distribution - ngx_openresty-1.2.6.6.tar.tgz , GeoIP-1.4.8.tar.gz
Extract and copy to /opt/
# cd /root/openresty/GeoIP-1.4.8
# ./configure ( if libtool error occure install below)
# make
# make install
# cd /opt/ngx_openresty-1.2.6.6/
# ./configure --with-luajit
# make
# make install
Testing
# mkdir /root/luatest
# cd /root/luatest
# mkdir conf logs
Edit nginx.conf and paste following
#
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
}
#
Start nginx -
# /usr/local/openresty/nginx/sbin/nginx -p /root/luatest -c /root/luatest/conf/nginx.conf
If error comes for lib, execute following and then again start nginx
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
# curl http://127.0.0.1:8080/
Thanks
No comments:
Post a Comment