#安装luajitcd /usr/local/wget http://luajit.org/download/LuaJIT-2.0.0-beta9.tar.gztar zxvf LuaJIT-2.0.0-beta9.tar.gzmv LuaJIT-2.0.0-beta9 luajitcd luajit make make install PREFIX=/usr/local/luajitexport LUAJIT_LIB=/usr/local/luajit/libexport LUAJIT_INC=/usr/local/luajit/include/luajit-2.0export LD_LIBRARY_PATH=/usr/local/luajit/lib:$LD_LIBRARY_PATHwget -O lua_nginx_module-0.9.2.zip https://codeload.github.com/chaoslawful/lua-nginx-module/zip/v0.9.2unzip lua_nginx_module-0.9.2.zipcd chaoslawful-lua-nginx-module-a624ee9wget -O ngx_devel_kit-0.2.18.tar.gz https://github.com/simpl/ngx_devel_kit/archive/v0.2.18.tar.gztar zxvf ngx_devel_kit-0.2.18.tar.gzcd ngx_devel_kit-0.2.18./configure \--prefix=/usr/local/nginx \--with-http_ssl_module \--with-http_realip_module \--with-http_addition_module \--with-http_gzip_static_module \--with-http_random_index_module \--with-http_stub_status_module \--with-http_sub_module \--with-http_dav_module \--with-pcre=/var/mycache/pcre-8.33 \--add-module=/var/mycache/ngx_devel_kit-0.2.18 \--add-module=/var/mycache/lua-nginx-module-0.9.2make -j2make install
centos是不允许监听1024以上的端口,所以需要修改nginx端口成8080,然后使用防火墙转发到80端口到8080
1、 首先应该做的是/etc/sysctl.conf配置文件的 net.ipv4.ip_forward = 1 默认是0 这样允许iptalbes FORWARD。2、 service iptables stop 关闭防火墙3、 重新配置规则vi /etc/sysconfig/iptables在COMMIT之前添加:-A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080-A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 80805、 启动iptables 服务, service iptables restart