Nginx1.10.1lua Environment Compilation Installation steps detailed

Source: Internet
Author: User
Tags curl lua openssl git clone

Installation

Download Nginx & pcre & Luajit

[Root@linuxea local]# curl-so http://nginx.org/download/nginx-1.10.1.tar.gz
[Root@linuxea local]# curl-so http://nchc.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz
[Root@linuxea local]# curl-so http://luajit.org/download/LuaJIT-2.0.4.tar.gz
Extract

[Root@linuxea local]# Tar XF nginx-1.10.1.tar.gz
[Root@linuxea local]# ln-s nginx-1.10.1 nginx
[Root@linuxea local]# Tar XF pcre-8.39.tar.gz
[Root@linuxea local]# Tar XF luajit-2.0.4.tar.gz
Compiling Luajit

[Root@linuxea local]# Yum Install gcc-y
[Root@linuxea local]# CD LuaJIT-2.0.4
[Root@linuxea luajit-2.0.4]# make && make install
Compiling pcre

[Root@linuxea local]# yum install gcc-c++-y
[Root@linuxea local]# cd pcre-8.39 &&/configure
[Root@linuxea local]# make && make install
Setting environment variables

[Root@linuxea local]# Export Luajit_lib=/usr/local/lib
[Root@linuxea luajit-2.0.4]# Export luajit_inc=/usr/local/include/luajit-2.0/
Create a user

[Root@linuxea nginx]# useradd-s/sbin/nologin-m nginx
[Root@linuxea luajit-2.0.4]# CD ... /nginx
### Get Ngx_devel_kit & Lua-nginx-module
Before compiling, we are here to download the corresponding module Https://github.com/simpl/ngx_devel_kit#warning-using-ndk_all

[Root@linuxea local]# yum install git
[Root@linuxea local]# git clone https://github.com/simpl/ngx_devel_kit.git
In downloading a lua-nginx-module
[Root@linuxea local]# git clone https://github.com/openresty/lua-nginx-module.git

Start compiling Nginx

--add specified directory can

Before compiling, we install the dependency pack

[Root@linuxea nginx]# yum install-y OpenSSL openssl-devel
[Root@linuxea nginx]#./configure--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-file-aio \
--add-module=.. /ngx_devel_kit/\
--add-module=.. /lua-nginx-module/\
--with-http_gzip_static_module \
--with-http_flv_module \
--with-pcre=/usr/local/pcre-8.39 \
--with-http_mp4_module \
--http-client-body-temp-path=/var/tmp/nginx/client \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--HTTP-FASTCGI-TEMP-PATH=/VAR/TMP/NGINX/FASTCGI \
--HTTP-UWSGI-TEMP-PATH=/VAR/TMP/NGINX/UWSGI \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock
[Root@linuxea nginx]# make-j2 && make install
[Root@linuxea nginx-1.10.1]# ln-s/usr/local/lib/libluajit-5.1.so.2/lib64/
[Root@linuxea nginx-1.10.1]# mkdir-p/var/tmp/nginx/{client,fastcgi,proxy,uwsgi}

We add a nginx lua to the server

[Root@linuxea conf]# VI nginx.conf
Location/linuxea {
Default_type ' Text/plain ';
Content_by_lua ' Ngx.say ("Hello,lua") ';
}
[Root@linuxea conf]#/usr/local/nginx/sbin/nginx-t
Nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/usr/local/nginx/conf/nginx.conf Test is successful

Shut down the firewall and start

[Root@linuxea conf]# setenforce 0
[root@linuxea conf]# echo-e ' Net.ipv6.conf.all.disable_ipv6 = 1\nnet.ipv6.conf . Default.disable_ipv6 = 1 ' >>/etc/sysctl.conf && sysctl-p
Net.ipv6.conf.all.disable_ipv6 = 1
Net. Ipv6.conf.default.disable_ipv6 = 1
Net.ipv6.conf.all.disable_ipv6 = 1
Net.ipv6.conf.default.disable_ipv6 = 1
[Root@linuxea conf]# systemctl mask firewalld
[Root@linuxea conf]# systemctl stop firewalld
[Root@linuxea con f]#/usr/local/nginx/sbin/nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.