In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the Centos7 installation Nginx integration Lua method related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe everyone after reading this Centos7 installation Nginx integration Lua method article will have a harvest, let's take a look at it.
Preparatory work
If the installed linux is networked and the linux port can be used externally, you can ignore the following two
1. Set to get ip automatically
(1) enter a command on linux
[root@localhost ~] ip addr # View IP [root @ localhost ~] nmcli connection show
You can view the current Nic information
Mine is ens33.
(2) modify information
[root@localhost ~] vi / etc/sysconfig/network-scripts/ifcfg-ens33
Change the last line of onboot=no to onboot=yes
(3) restart network services
[root@localhost ~] # systemctl restart network
two。 Turn off the firewall
Systemctl stop firewalld.service # stop firewallsystemctl disable firewalld.service # disable firewall boot
3. When you are ready to install, you can find that there is no wget command. You can install it on the line first. If you are prompted below that there is no wget command, you can perform this step.
[root@localhost ~] # yum-y install wget
Installation
1. Installation depends on the environment
[root@localhost ~] # yum-y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
two。 Install luajit
I created the luajit folder under the / usr/local path
[root@localhost luajit] # wget http://luajit.org/download/luajit-2.0.2.tar.gz[root@localhost luajit] # tar-xvf luajit-2.0.2.tar.gz [root@localhost luajit] # cd luajit-2.0.2 [root@localhost luajit-2.0.2] # make install
3. Install nginx
(1) download ngx_devel_kit, lua-nginx-module and nginx
I created the nginx folder under the / usr/local path
[root@localhost nginx] # wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz[root@localhost nginx] # wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz[root@localhost nginx] # wget http://nginx.org/download/nginx-1.12.1.tar.gz # Note the downloaded package does not have a file name But according to the version number, you can tell which file [root@localhost nginx] # tar-xvf v0.3.0.tar.gz [root@localhost nginx] # tar-xvf v0.10.9rc7.tar.gz [root@localhost nginx] # tar-xvf nginx-1.12.1.tar.gz
(2) compile nginx
[root@localhost nginx] # cd nginx-1.12.1 [root@localhost nginx-1.12.1] #. / configure-prefix=/usr/local/nginx-add-module=../ngx_devel_kit-0.3.0-add-module=../lua-nginx-module-0.10.9rc7
(3) installation
[root@localhost nginx-1.12.1] # make [root@localhost nginx-1.12.1] # make install
(4) start nginx
Nginx may report an error at startup
. / nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: n
The file libluajit-5.1.so.2 cannot be found
Solution.
1. Find libluajit-5.1.so.2,libluajit-5.1.so.2.0.2 and copy these two files to the corresponding lib
64-bit is / usr/lib64
32-bit is / usr/lib
[root@localhost nginx-1.12.1] # find /-name libluajit-5.1.so.2
find
Files are installed under / usr/local/lib/libluajit-5.1.so.2 by default
[root@localhost nginx-1.12.1] # cp / usr/local/lib/libluajit-5.1.so.2 / usr/lib64/ [root@localhost nginx-1.12.1] # cp / usr/local/lib/libluajit-5.1.so.2.0.2 / usr/lib64
In the nginx installation directory, modify the nginx.conf file
Add the following code under the server code block
Location / hello {default_type 'text/plain'; content_by_lua' ngx.say ("hello,lua")';}
Start nginx
[root@localhost nginx-1.12.1] #. / configure
Access the virtual corresponding address http://xxx.xxx.xxx/hello in the browser
Display as follows
This is the end of the article on "how to integrate Lua with Centos7 installation Nginx". Thank you for reading! I believe that everyone has a certain understanding of the "Centos7 installation Nginx integration Lua method" knowledge, if you want to learn more knowledge, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.