{"id":1492,"date":"2023-03-24T22:50:53","date_gmt":"2023-03-24T14:50:53","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1492"},"modified":"2023-04-28T20:29:27","modified_gmt":"2023-04-28T12:29:27","slug":"nginx-install-lua-nginx-module","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/24\/nginx-install-lua-nginx-module\/","title":{"rendered":"Nginx \u5b89\u88c5 lua-nginx-module"},"content":{"rendered":"<p>Nginx \u5b89\u88c5 lua-nginx-module\uff0c\u5373\u589e\u52a0Lua\u6a21\u5757<\/p>\n<h2>\u5b89\u88c5\u4f9d\u8d56<\/h2>\n<pre><code>yum install -y gcc g++ gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel<\/code><\/pre>\n<p><!-- more --><\/p>\n<h2>\u5b89\u88c5LuaJIT<\/h2>\n<pre><code>wget -c http:\/\/luajit.org\/download\/LuaJIT-2.0.5.tar.gz  \/\/http:\/\/luajit.org\/download.html\ntar -xzf LuaJIT-2.0.5.tar.gz\ncd LuaJIT-2.0.5\nmake install PREFIX=\/usr\/local\/luajit\n# \u6dfb\u52a0\u73af\u5883\u53d8\u91cf\nexport LUAJIT_LIB=\/usr\/local\/luajit\/lib\nexport LUAJIT_INC=\/usr\/local\/luajit\/include\/luajit-2.0\n\nln -s \/usr\/local\/luajit\/lib\/libluajit-5.1.so.2 \/lib64\/libluajit-5.1.so.2  #\u4e0d\u589e\u52a0\u8fd9\u884c\uff0cnginx\u542f\u52a8\u4f1a\u62a5\u9519<\/code><\/pre>\n<p>\u4ece <a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/luajit.org\/download.html\">http:\/\/luajit.org\/download.html<\/a> \u4e0b\u8f7d\u7684luajit\u6765\u5b89\u88c5Nginx\uff0c\u542f\u52a8\u65f6\u62a5\u9519\u5982\u4e0b<\/p>\n<pre><code>nginx: [alert] detected a LuaJIT version which is not OpenResty&#039;s; many optimizations will be disabled and performance will be compromised (see https:\/\/github.com\/openresty\/luajit2 for OpenResty&#039;s LuaJIT or, even better, consider using the OpenResty releases from https:\/\/openresty.org\/en\/download.html)<\/code><\/pre>\n<p>\u5148\u5378\u8f7d\u539f\u6709luajit\uff0c\u7136\u540e\u4ece <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/openresty\/luajit2\">https:\/\/github.com\/openresty\/luajit2<\/a> \u6216 <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/openresty\/luajit2\/releases\">https:\/\/github.com\/openresty\/luajit2\/releases<\/a> \u4e0b\u8f7d<\/p>\n<pre><code>rm -rf \/usr\/local\/luajit\ngit clone https:\/\/github.com\/openresty\/luajit2\nmake &amp;&amp; make install\nexport LUAJIT_LIB=\/usr\/local\/lib\nexport LUAJIT_INC=\/usr\/local\/include\/luajit-2.1\n\nln -s \/usr\/local\/lib\/libluajit-5.1.so.2 \/lib64\/libluajit-5.1.so.2  #\u4e0d\u589e\u52a0\u8fd9\u884c\uff0cnginx\u542f\u52a8\u4f1a\u62a5\u9519<\/code><\/pre>\n<h2>\u5b89\u88c5Nginx<\/h2>\n<pre><code>mkdir -p \/opt\/modules\ncd \/opt\/modules\n\nwget https:\/\/github.com\/simpl\/ngx_devel_kit\/archive\/v0.3.0.tar.gz\ntar -xzf v0.3.0.tar.gz\n\nwget https:\/\/github.com\/openresty\/lua-nginx-module\/archive\/v0.10.14.tar.gz\ntar -xzf v0.10.14.tar.gz<\/code><\/pre>\n<pre><code>wget http:\/\/nginx.org\/download\/nginx-1.16.0.tar.gz\ntar -xzf nginx-1.16.0.tar.gz\ncd nginx-1.16.0\n\n.\/configure --user=nginx --group=nginx --prefix=\/usr\/local\/nginx --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-cc-opt=-O3 --with-stream --add-module=\/opt\/modules\/ngx_devel_kit-0.3.0 --add-module=\/opt\/modules\/lua-nginx-module-0.10.14\nmake\nmake install<\/code><\/pre>\n<p>lua-nginx-module-0.10.15\u7248\u672c\u62a5\u9519\uff1a<\/p>\n<pre><code>nginx: [error] lua_load_resty_core failed to load the resty.core module from https:\/\/github.com\/openresty\/lua-resty-core; ensure you are using an OpenResty release from https:\/\/openresty.org\/en\/download.html (rc: 2, reason: module &#039;resty.core&#039; not found:\n    no field package.preload[&#039;resty.core&#039;]\n    no file &#039;\/opt\/verynginx\/verynginx\/lua_script\/resty\/core.lua&#039;\n    no file &#039;.\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/luajit\/share\/luajit-2.0.5\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/share\/lua\/5.1\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/share\/lua\/5.1\/resty\/core\/init.lua&#039;\n    no file &#039;\/usr\/local\/luajit\/share\/lua\/5.1\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/luajit\/share\/lua\/5.1\/resty\/core\/init.lua&#039;\n    no file &#039;\/opt\/verynginx\/verynginx\/lua_script\/module\/resty\/core.lua&#039;\n    no file &#039;.\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/luajit\/share\/luajit-2.0.5\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/share\/lua\/5.1\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/share\/lua\/5.1\/resty\/core\/init.lua&#039;\n    no file &#039;\/usr\/local\/luajit\/share\/lua\/5.1\/resty\/core.lua&#039;\n    no file &#039;\/usr\/local\/luajit\/share\/lua\/5.1\/resty\/core\/init.lua&#039;\n    no file &#039;\/opt\/verynginx\/verynginx\/lua_script\/resty\/core.so&#039;\n    no file &#039;.\/resty\/core.so&#039;\n    no file &#039;\/usr\/local\/lib\/lua\/5.1\/resty\/core.so&#039;\n    no file &#039;\/usr\/local\/luajit\/lib\/lua\/5.1\/resty\/core.so&#039;\n    no file &#039;\/usr\/local\/lib\/lua\/5.1\/loadall.so&#039;\n    no file &#039;\/opt\/verynginx\/verynginx\/lua_script\/resty.so&#039;\n    no file &#039;.\/resty.so&#039;\n    no file &#039;\/usr\/local\/lib\/lua\/5.1\/resty.so&#039;\n    no file &#039;\/usr\/local\/luajit\/lib\/lua\/5.1\/resty.so&#039;\n    no file &#039;\/usr\/local\/lib\/lua\/5.1\/loadall.so&#039;)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nginx \u5b89\u88c5 lua-nginx-module\uff0c\u5373\u589e\u52a0Lua\u6a21\u5757 \u5b89\u88c5\u4f9d\u8d56 yum install -y  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[332],"tags":[88,366],"class_list":["post-1492","post","type-post","status-publish","format-standard","hentry","category-nginx","tag-lua","tag-verynginx"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1492"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1492\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}