AWS攻略——在EC2上安装带LuaJIT的Nginx

Nginx集成LuaJIT与ngx_devel_kit及lua-nginx-module的安装教程
该文详细介绍了如何下载并安装Nginx、ngx_devel_kit、lua-nginx-module以及LuaJIT,包括依赖的安装、配置编译过程,最后启动Nginx的步骤,适用于系统优化和Web服务器扩展。

下载依赖

下载nginx

wget http://nginx.org/download/nginx-1.20.1.tar.gz
tar -xf nginx-1.20.1.tar.gz

下载ngx_devel_kit

wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.0.tar.gz
tar -xf v0.3.0.tar.gz

下载lua-nginx-module

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.13.tar.gz
tar -xf v0.10.13.tar.gz

下载LuaJIT

wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
tar -xf LuaJIT-2.0.5.tar.gz

安装依赖

安装LuaJIT

cd LuaJIT-2.0.5/
sudo make install  PREFIX=/usr/local/LuaJIT
cd ~
export LUAJIT_LIB=/usr/local/LuaJIT/lib
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0

安装编译依赖

sudo yum install -y gcc  gcc-c++ make libtool zlib zlib-devel pcre pcre-devel readline-devel openssl-devel libxml2 libxml2-devel.x86_64 libxslt-devel gperftools-devel  gd-devel perl-ExtUtils-Embed

配置编译

cd ~/nginx-1.20.1
./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/home/ec2-user/nginx/conf/nginx.conf --error-log-path=/home/ec2-user/nginx/log/error.log --http-log-path=/home/ec2-user/log/nginx/access.log --http-client-body-temp-path=/home/ec2-user/nginx/tmp/client_body --http-proxy-temp-path=/home/ec2-user/nginx/tmp/proxy --http-fastcgi-temp-path=/home/ec2-user/nginx/tmp/fastcgi --http-uwsgi-temp-path=/home/ec2-user/nginx/tmp/uwsgi --http-scgi-temp-path=/home/ec2-user/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=ec2-user --group=ec2-user --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-Wno-error -Wno-deprecated-declarations -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' --with-ld-opt=-Wl,-rpath,/usr/local/LuaJIT/lib --add-module=/home/ec2-user/ngx_devel_kit-0.3.0 --add-module=/home/ec2-user/lua-nginx-module-0.10.13

编译

sudo make 
sudo make install

使用

sudo mkdir -p /home/ec2-user/nginx/tmp/client_body
sudo /usr/sbin/nginx

注意事项

配置文件路径 /home/ec2-user/nginx/conf/nginx.conf

参考资料

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

breaksoftware

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值