Because the blog of the blogger uses nginx, it is intended to be upgraded smoothly and configured as openresty. Here I have configured it and recorded it for you, you can test it through www.widuu.com/lua.
# Centos
Yum install libtermcap-devel ncurses-devel libevent-devel readline-devel pcre-devel openssl-devel gcc-y
# Ubnutu
Apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
Libssl-dev perl make build-essential
2. Install software and extensions
(Note) here I installed nginx, but my version is 1.6.0 and does not support it, so it can only be upgraded smoothly. If you are a new installation, you only need to replace make upgrade in the last step with make install.
In http://luajit.org/download.html here now luajit, I chose stable version 2.0 you can choose 2.1 this here doesn't matter.
Download the lua5.1 * version in the http://www.lua.org/ftp/ here, because currently only Version 5.1 is supported.
Download the latest nginx_devel_kit in the https://github.com/simpl/ngxdevelkit/tags.
Download the latest version of lua-nginx-module from the https://github.com/openresty/lua-nginx-module/tags.
Download headers-more-nginx-module in the https://github.com/openresty/headers-more-nginx-module/tags.
Download echo-nginx-module in the https://github.com/openresty/echo-nginx-module/tags.
Download xss-nginx-module in the https://github.com/openresty/xss-nginx-module/tags.
Download array-var-nginx-module in https://github.com/openresty/array-var-nginx-module/tags.
Download the rds-json-nginx-module in the https://github.com/openresty/rds-json-nginx-module/tags.
Download https://github.com/openresty/redis2-nginx-module/tags in redis2-nginx-module
Download memc-nginx-module in the https://github.com/openresty/memc-nginx-module.
Download the rds-csv-nginx-module in the https://github.com/openresty/rds-csv-nginx-module/tags.
Download form-input-nginx-module in the https://github.com/calio/form-input-nginx-module/tags.
Download iconv-nginx-module in the https://github.com/calio/iconv-nginx-module/tags. (Optional)
Download ngx_coolkit in the https://github.com/FRiCKLE/ngx_coolkit/tags.
Download set-misc-nginx-module in the https://github.com/openresty/set-misc-nginx-module/tags.
Download encrypted-session-nginx-module in the https://github.com/openresty/encrypted-session-nginx-module/tags.
Download srcache-nginx-module in the https://github.com/openresty/srcache-nginx-module/tags.
Download lua-upstream-nginx-module in the https://github.com/openresty/lua-upstream-nginx-module/tags.
Download http://nginx.org/en/download.html. Because the version of the agent is later than 1.6, the installation version must be later than 1.6.
3. Unzip and install
Decompress all the above packages and put them in a folder. Put them in/data/soft and install them.
1. Install lua
Cd lua *
Make linux test
# My personal preferences
Cp src/lua/usr/local/lua
2. Install LuaJIT
Cd ../LuaJIT *
Make
# Here you can use make install PREFIX =/path to specify your installation directory. The default lib Library is installed under/usr/local/lib.
Make install
3. I have installed nginx, so it is a smooth upgrade. You can install nginx directly.
# If 2.0 is used to specify the luajit installation directory of 2.0
Export LUAJIT_LIB =/path/to/luajit/lib
Export LUAJIT_INC =/path/to/luajit/include/luajit-2.0
# If it is 2.1, specify the 2.1 installation directory
Export LUAJIT_LIB =/path/to/luajit/lib
Export LUAJIT_INC =/path/to/luajit/include/luajit-2.1
If you are upgrading, you can do this. The directory where my nginx is stored is/usr/local/nginx, and then
Mv/usr/local/nginx/sbin/nginx. old
# Enter the nginx installation package
Cd nginx *
# Configure parameter. Note: I added-module to omit all later versions. You have matched your version number and path.
./Configure -- prefix =/usr/local/nginx \
-- With-ld-opt = "-Wl,-rpath,/usr/local/lib "\
-- Add-module = ../ngx_devel_kit \
-- Add-module = ../lua-nginx-module \
-- Add-module = ../iconv-nginx-module \
-- Add-module = ../echo-nginx-module \
-- Add-module = ../xss-nginx-module \
-- Add-module = ../ngx_coolkit \
-- Add-module = ../set-misc-nginx-module \
-- Add-module = ../form-input-nginx-module \
-- Add-module = ../encrypted-session-nginx-module \
-- Add-module = ../srcache-nginx-module \
-- Add-module = ../lua-upstream-nginx-module \
-- Add-module = ../headers-more-nginx-module \
-- Add-module = ../array-var-nginx-module \
-- Add-module = ../memc-nginx-module \
-- Add-module = ../redis-nginx-module \
-- Add-module = ../rds-json-nginx-module \
-- Add-module = ../rds-csv-nginx-module \
# Add your nginx configure parameter here.
# Compile
Make
Note that if you are upgrading, do not make install.
Cp objs/nginx/usr/local/nginx/sbin/nginx
Make upgrade
If not, install
Make install
Here you have installed
/Usr/local/nginx/sbin/nginx-V # You can view the parameters.
4. Test it.
Vim yourwebsite. conf
# Add the following
Location/lua {
Default_type text/html;
Content_by_lua'
Ngx. say ("hello word lua ");
';
}