Last active
August 29, 2015 14:22
-
-
Save soerenmartius/0c3549824cb3db2c0031 to your computer and use it in GitHub Desktop.
Install NGINX with Lua in unix shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# | |
# bash < <(curl -s https://gist.githubusercontent.com/caramba1337/0c3549824cb3db2c0031/raw/64e018a7d739e159e3a7bb8bb70f0c422bdf4ec4/install_nginx_with_lua_in_unix_shell.bash) | |
set -x | |
cd /tmp | |
if ! test -d /usr/local/include/luajit-2.0; then | |
echo "Installing LuaJIT-2.0.3." | |
wget "http://luajit.org/download/LuaJIT-2.0.3.tar.gz" | |
tar -xzvf LuaJIT-2.0.3.tar.gz | |
cd LuaJIT-2.0.3 | |
make | |
make install | |
else | |
echo "Skipping LuaJIT-2.0.3, as it's already installed." | |
fi | |
cd .. | |
wget "https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz" | |
tar -xzvf v0.2.19.tar.gz | |
NGX_DEV="/tmp/ngx_devel_kit-0.2.19" | |
wget "https://github.com/openresty/lua-nginx-module/archive/master.tar.gz" | |
tar -zxvf master.tar.gz | |
LUA_MOD="/tmp/lua-nginx-module-master" | |
wget 'http://nginx.org/download/nginx-1.9.1.tar.gz' | |
tar -xzvf nginx-1.9.1.tar.gz | |
cd nginx-1.9.1 | |
export LUAJIT_LIB=/usr/local/lib | |
export LUAJIT_INC=/usr/local/include/luajit-2.0 | |
./configure --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' \ | |
--with-ld-opt=-Wl,-z,relro \ | |
--prefix=/usr/share/nginx \ | |
--conf-path=/etc/nginx/nginx.conf \ | |
--http-log-path=/var/log/nginx/access.log \ | |
--error-log-path=/var/log/nginx/error.log \ | |
--lock-path=/var/lock/nginx.lock \ | |
--pid-path=/run/nginx.pid \ | |
--http-client-body-temp-path=/var/lib/nginx/body \ | |
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ | |
--http-proxy-temp-path=/var/lib/nginx/proxy \ | |
--http-scgi-temp-path=/var/lib/nginx/scgi \ | |
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ | |
--with-debug \ | |
--with-pcre-jit \ | |
--with-ipv6 \ | |
--with-http_ssl_module \ | |
--with-http_stub_status_module \ | |
--with-http_realip_module \ | |
--with-http_auth_request_module \ | |
--with-http_gzip_static_module \ | |
--with-http_spdy_module \ | |
--add-module=$NGX_DEV \ | |
--add-module=$LUA_MOD | |
make -j2 | |
make install | |
unset LUAJIT_LIB | |
unset LUAJIT_INC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment