{"id":34590,"date":"2023-07-10T09:29:08","date_gmt":"2022-12-21T11:24:55","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/"},"modified":"2024-04-30T12:51:02","modified_gmt":"2024-04-30T04:51:02","slug":"%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/","title":{"rendered":"\u719f\u7ec3\u8fd0\u7528lua-nginx-module"},"content":{"rendered":"<hr \/>\n<p>\uff082016.3\u66f4\u65b0\uff09<br \/>\n\u6211\u5927\u7ea6\u4e24\u5e74\u524d\u5199\u7684\u90a3\u7bc7\u6587\u7ae0\uff0c\u5c3d\u7ba1\u4e0e\u5f53\u65f6\u76f8\u6bd4\uff0cnginx\u7684\u7248\u672c\u5df2\u7ecf\u63d0\u5347\u4e86\uff0c\u4f46\u4f3c\u4e4e\u4ecd\u7136\u6709\u4eba\u5076\u5c14\u4f1a\u67e5\u770b\u8be5\u6587\u7ae0\u3002\u4f3c\u4e4eNginx Lua API\u4e2d\u4e5f\u6709\u4e00\u4e9b\u65b0\u589e\u5185\u5bb9\uff0c\u4f46\u5e76\u4e0d\u9700\u8981\u8fdb\u884c\u5927\u5e45\u4fee\u6539\u3002\u4e0d\u8fc7\uff0c\u6709\u4e00\u4e9b\u94fe\u63a5\u6587\u6863\u5df2\u7ecf\u5931\u6548\uff0c\u5176\u4e2d\u4e00\u4e9bAPI\u4e5f\u5df2\u88ab\u6807\u8bb0\u4e3a\u4e0d\u63a8\u8350\u4f7f\u7528\uff0c\u6240\u4ee5\u6211\u7a0d\u4f5c\u4e86\u66f4\u65b0\u3002<\/p>\n<hr \/>\n<p>\u5c3d\u7ba1lua-nginx-module\u5bf9\u4e8e\u4f7f\u7528nginx\u7684\u4eba\u975e\u5e38\u65b9\u4fbf\uff0c\u4f46\u5173\u4e8e\u5b83\u7684\u65e5\u6587\u4fe1\u606f\u8fd8\u662f\u76f8\u5bf9\u7a00\u5c11\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">http:\/\/wiki.nginx.org\/HttpLuaModule<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">https:\/\/github.com\/openresty\/lua-nginx-module<\/ul>\n<p>\u6211\u7ecf\u5e38\u770b\u5230\u6709\u4eba\u5199\u5173\u4e8e\u5b89\u88c5\u5e76\u8bd5\u7528\u67d0\u4e2a\u8f6f\u4ef6\u7684\u6587\u7ae0\uff0c\u4f46\u5f53\u6211\u6253\u7b97\u771f\u6b63\u5f00\u59cb\u4f7f\u7528\u65f6\uff0c\u5f88\u96be\u627e\u5230\u76f8\u5173\u7684\u4fe1\u606f\u3002\u5728\u6211\u7a0d\u5fae\u8c03\u67e5\u4e86\u4e00\u4e0b\u7684\u8303\u56f4\u5185\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5b9d\u8d35\u7684\u65e5\u8bed\u4fe1\u606f\u6765\u6e90\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">[nginx] lua-nginx-module \u306e\u7d39\u4ecb \u306a\u3089\u3073\u306b Nginx+Lua+Redis\u306b\u3088\u308b\u52d5\u7684\u306a\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u306e\u5b9f\u88c5\u6848<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">nginx\u3068Lua\u306e\u8a71<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Using ngx_lua \/ lua-nginx-module in pixiv<\/ul>\n<p>\u8fd9\u6b21\u4e3a\u4e86\u90a3\u4e9b\u60f3\u8981\u5145\u5206\u4f7f\u7528\u7684\u4eba\uff0c\u6211\u60f3\u7a0d\u5fae\u8be6\u7ec6\u5199\u4e00\u4e0b\u3002<br \/>\n\uff03\u56e0\u6b64\uff0c\u5b89\u88c5\u4e4b\u7c7b\u7684\u4f1a\u7701\u7565\u2026\u2026<\/p>\n<h2>nginx\u5904\u7406HTTP\u8bf7\u6c42<\/h2>\n<p>\u7531\u4e8e lua-nginx-module \u6a21\u5757\u662f\u5728 nginx \u7684\u8bf7\u6c42\u5904\u7406\u6bcf\u4e2a\u9636\u6bb5\u8c03\u7528\uff0c\u56e0\u6b64\u9996\u5148\u8ba9\u6211\u4eec\u7b80\u5355\u4e86\u89e3\u4e00\u4e0b nginx \u7684 HTTP \u8bf7\u6c42\u5904\u7406\u3002<\/p>\n<p>\u5728nginx\u4e2d\uff0c\u5f53\u63a5\u6536\u5230\u5bf9\u6b63\u5728\u76d1\u542c\u7684\u7aef\u53e3\u7684\u8bbf\u95ee\u65f6\uff0c\u5c06\u6309\u7167\u5982\u4e0b\u9636\u6bb5\u6765\u5904\u7406\u8bf7\u6c42\u3002<\/p>\n<div>\n<div class=\"post-table\">Phase\u6982\u8981server selectionnginx.conf \u306e\u4e2d\u306e server \u3092\u9078\u629epost read\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u304b\u3089\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97server rewrite\u30b5\u30fc\u30d0\u30ec\u30d9\u30eb\u306e URI \u306e rewrite\u51e6\u7406location selectionlocation \u3092\u9078\u629elocation rewritelocation \u30ec\u30d9\u30eb\u306e URI \u306e rewrite\u51e6\u7406preaccessaccess\u51e6\u7406\u3067\u5fc5\u8981\u306a\u60c5\u5831\u306e\u53d6\u5f97accessIP\u30a2\u30c9\u30ec\u30b9\u5236\u9650\u3084 Basic\u8a8d\u8a3c\u7b49\u3001\u30a2\u30af\u30bb\u30b9\u306e\u8a8d\u53ef\u30c1\u30a7\u30c3\u30aftry filestry_files \u306e\u51e6\u7406 (<a href=\"http:\/\/heartbeats.jp\/hbblog\/2012\/04\/nginx05.html\" target=\"_blank\" rel=\"nofollow noopener\">\u53c2\u8003<\/a>)content\u30e1\u30a4\u30f3\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u51e6\u7406\u3002\u751f\u6210\u3057\u305f\u308a proxy \u3068\u3057\u3066\u50cd\u3044\u305f\u308a\u3002log\u30ed\u30b0\u3092\u6b8b\u3059post actionpost_action\uff08\u30ea\u30af\u30a8\u30b9\u30c8\u5b8c\u4e86\u5f8c\uff09\u306e\u51e6\u7406<\/div>\n<\/div>\n<p>\u53c2\u8003\uff1a<\/p>\n<ul class=\"post-ul\">http:\/\/wiki.nginx.org\/Phases<\/ul>\n<p>\uff082016\u5e743\u6708\u66f4\u65b0\uff09\u4e0a\u8ff0\u7f51\u5740\u7684\u9875\u9762\u5df2\u7ecf\u6d88\u5931\u4e86\u3002\u5f88\u53ef\u60dc\uff0c\u5728\u5b98\u65b9\u9875\u9762\u4e0a\u6ca1\u6709\u627e\u5230\u7c7b\u4f3c\u7684\u8bf4\u660e\u3002\u8bf7\u53c2\u8003\u4e0b\u9762\u7684\u5185\u5bb9\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">http:\/\/www.aosabook.org\/en\/nginx.html#sec.nginx.internals<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">http:\/\/www.nginxguts.com\/2011\/01\/phases\/<\/ul>\n<\/li>\n<\/ul>\n<p>http:\/\/www.programering.com\/a\/MzN4MzMwATY.html<br \/>\n<iframe loading=\"lazy\" title=\"Nginx Internals\" src=\"https:\/\/www.slideshare.net\/slideshow\/embed_code\/key\/8sblJRUJEOB59i\" width=\"427\" height=\"356\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen> <\/iframe> <\/p>\n<div style=\"margin-bottom:5px\"> <strong> <a href=\"https:\/\/www.slideshare.net\/joshzhu\/nginx-internals\" title=\"Nginx Internals\" target=\"_blank\">Nginx Internals<\/a> <\/strong> from <strong><a href=\"https:\/\/www.slideshare.net\/joshzhu\" target=\"_blank\">Joshua Zhu<\/a><\/strong> <\/div>\n<h2>lua-nginx \u6a21\u5757\u94a9\u5b50\u5904\u7406\u7684\u8fc7\u7a0b<\/h2>\n<p>lua-nginx-module \u63d0\u4f9b\u4e86\u94a9\u5b50\u673a\u5236\uff0c\u7528\u4e8e\u4e0e nginx \u7684 Rewrite\u3001Access\u3001Content\u3001Log \u9636\u6bb5\u8fdb\u884c\u4ea4\u4e92\u3002\u4e0b\u9762\u5217\u51fa\u4e86 lua-nginx-module \u5728\u6bcf\u4e2a\u9636\u6bb5\u63d0\u4f9b\u7684\u4e3b\u8981\u94a9\u5b50\u673a\u5236\uff08\u5373 nginx \u6307\u4ee4\uff09\u3002<\/p>\n<p>\uff082016.3\u66f4\u65b0\uff09\u4ee5\u4e0b\u4ecb\u7ecd\u4e86 xxx_by_lua \u6307\u4ee4\uff0c\u4f46\u8fd9\u5df2\u88ab\u5f03\u7528\uff0c\u5efa\u8bae\u6539\u7528 xxx_by_lua_block\u3002\u5b83\u4eec\u51e0\u4e4e\u76f8\u540c\uff0c\u53ea\u662f\u4f7f\u7528\u4e86\u62ec\u5728{}\u4e2d\u7684\u4ee3\u7801\u5757\u800c\u4e0d\u662f\u5b57\u7b26\u4e32\u8fdb\u884c\u5b9a\u4e49\u3002\u6240\u4ee5\u4e0b\u9762\u5c06 xxx_by_lua \u7406\u89e3\u4e3a xxx_by_lua_block\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Rewrite Phase<\/ul>\n<\/li>\n<\/ul>\n<p>set_by_lua\uff1a\u5909\u6570\u306e\u8a2d\u5b9a\u3001\u30d8\u30c3\u30c0\u306e\u64cd\u4f5c\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u7b49\u304c\u53ef\u80fd<br \/>\nrewrite_by_lua\uff1aRewrite Phase \u306e\u6700\u5f8c\u3067\u5b9f\u65bd\u3055\u308c\u3001\u81ea\u7531\u5ea6\u306e\u9ad8\u3044 rewrite\u51e6\u7406\u3092\u5b9f\u73fe\u53ef\u80fd<\/p>\n<p>Access Phase<\/p>\n<p>access_by_lua\uff1a\u81ea\u7531\u5ea6\u306e\u9ad8\u3044\u8a8d\u53ef\u51e6\u7406\u3092\u5b9f\u73fe\u53ef\u80fd<\/p>\n<p>Content Phase<\/p>\n<p>content_by_lua\uff1a\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u751f\u6210<br \/>\nheader_filter_by_lua\uff1a\u30b3\u30f3\u30c6\u30f3\u30c4\u751f\u6210\u5f8c\u3001header \u306b\u5bfe\u3059\u308b\u30d5\u30a3\u30eb\u30bf\u51e6\u7406\uff08\u66f8\u304d\u63db\u3048\u3084\u8ffd\u52a0\u306a\u3069\uff09\u306b\u5bfe\u5fdc<br \/>\nbody_filter_by_lua\uff1a\u30b3\u30f3\u30c6\u30f3\u30c4\u751f\u6210\u5f8c\u3001body \u306b\u5bfe\u3059\u308b\u30d5\u30a3\u30eb\u30bf\u51e6\u7406<\/p>\n<p>Log Phase<\/p>\n<p>log_by_lua\uff1a\u30ed\u30b0\u51e6\u7406\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u52d5\u4f5c\u3002\u3053\u3053\u3067\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u60c5\u5831\u3092\u5909\u6570\u306b\u305f\u3081\u3066\u304a\u304f\u3053\u3068\u3067\u3001nginx + lua \u3060\u3051\u3067\u96c6\u8a08\u306e\u4ed5\u7d44\u307f\u3092\u4f5c\u308b\u3053\u3068\u3082\u53ef\u80fd<\/p>\n<p>\u5982\u679c\u5728\u6bcf\u4e2a\u6307\u4ee4\u7684\u540d\u79f0\u540e\u9762\u52a0\u4e0a&#8221;_file&#8221;\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u5916\u90e8\u6587\u4ef6\u6765\u5b9a\u4e49Lua\u4ee3\u7801\uff0c\u800c\u4e0d\u9700\u8981\u76f4\u63a5\u5728nginx.conf\u4e2d\u7f16\u5199\u3002\u5982\u679c\u8981\u7f16\u5199\u8f83\u5927\u7684\u4ee3\u7801\uff0c\u6700\u597d\u5206\u5f00\u7ba1\u7406\u3002<\/p>\n<p>\u5982\u679c\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5c06\u6587\u4ef6\u5206\u5f00\u7f16\u5199\uff0c\u5c06lua_code_cache\u8bbe\u7f6e\u4e3aOFF\uff0c\u53ef\u4ee5\u5728\u6bcf\u6b21\u4f7f\u7528_file\u8bfb\u53d6\u65f6\u4e0d\u8fdb\u884c\u7f13\u5b58\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u6bcf\u6b21\u90fd\u91cd\u65b0\u52a0\u8f7dnginx\uff0c\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<p>\u53ea\u9700\u4e00\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0b\u662f\u7528\u4e2d\u6587\u7684\u4e00\u79cd\u91cd\u8ff0\u65b9\u5f0f\uff1a<br \/>\ninit_by_lua \u548c init_by_lua_file \u4e0d\u5c5e\u4e8e\u4ee5\u4e0a\u9636\u6bb5\uff0c\u800c\u662f\u5728 nginx \u91cd\u65b0\u52a0\u8f7d\u65f6\u7b49\u521d\u59cb\u5316\u65f6\u8fd0\u884c\uff0c\u56e0\u6b64\u53ef\u4ee5\u7528\u4e8e\u53d8\u91cf\u7b49\u7684\u521d\u59cb\u5316\u3002<\/p>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u4f60\u53ef\u4ee5\u5728Lua\u811a\u672c\u4e2d\u4f7f\u7528ngx.get_phase\u6765\u83b7\u53d6\u5f53\u524d\u9636\u6bb5\u3002<\/p>\n<p>\u89c2\u6469<\/p>\n<p>https:\/\/github.com\/openresty\/lua-nginx-module#directives<br \/>\n(2016.3 \u30ea\u30f3\u30af\u4fee\u6b63)<\/p>\n<p>\u9664\u4e86\u4e0a\u8ff0\u4ecb\u7ecd\u7684\uff0c\u8fd8\u6709\u4e00\u4e9b\u4f3c\u4e4e\u53ef\u4ee5\u4f7f\u7528\u7684\u6307\u4ee4\u589e\u52a0\u4e86\u3002\u4f8b\u5982\uff0cbalancer_by_lua_block\u6216ssl_certificate_by_lua_block\u7b49\u3002\u8bf7\u53c2\u9605\u4e0a\u8ff0URL\u4ee5\u83b7\u53d6\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<h2>Nginx API \u53ef\u5728 lua-nginx-module \u4e2d\u4f7f\u7528\u3002<\/h2>\n<p>\u5728\u4e0a\u8ff0\u5404\u79cd\u94a9\u5b50\uff08*_by_lua\uff09\u4e2d\u8c03\u7528\u7684Lua\u4ee3\u7801\u53ef\u4ee5\u67e5\u770b\u6807\u5934\u6216\u8bf7\u6c42\u5185\u5bb9\uff0c\u5171\u4eab\u914d\u7f6e\u6216\u53d8\u91cf\u5728nginx\u7684\u5de5\u4f5c\u8fdb\u7a0b\u4e4b\u95f4\uff0c\u5e76\u6267\u884c\u67d0\u4e9b\u64cd\u4f5c\u3002\u4e3a\u4e86\u7075\u6d3b\u5730\u6267\u884c\u8fd9\u6837\u7684\u64cd\u4f5c\uff0clua-nginx-module\u63d0\u4f9b\u4e86\u5404\u79cdNginx Lua API\u3002<\/p>\n<p>\u88ab_by_lua\u8c03\u7528\u7684Lua\u4ee3\u7801\u5c06\u5728_by_lua\u7684\u4e0a\u4e0b\u6587\u4e2d\u8fd0\u884c\uff0c\u4f46\u6bcf\u4e2a\u4e0a\u4e0b\u6587\u4e2d\u53ef\u4f7f\u7528\u7684Nginx Lua API\u90fd\u6709\u4e00\u4e9b\u9650\u5236\u3002\u4f8b\u5982\uff0c\u79f0\u4e3angx.location.caputure\u7684API\u53ea\u80fd\u5728rewrite_by_lua\uff0caccess_by_lua*\uff0ccontent_by_lua*\u4e2d\u4f7f\u7528\u3002<\/p>\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u5c06\u4ecb\u7ecd\u4e3b\u8981\u7684 Nginx Lua API\u3002<\/p>\n<h3>ngx.var.VARIABLE<br \/>\n\u53d8\u91cf<\/h3>\n<p>\u4f7f\u7528\u6b64\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u8bbf\u95ee\u5728nginx.conf\u4e2d\u901a\u8fc7set\u547d\u4ee4\u8bbe\u7f6e\u7684\uff08\u58f0\u660e\u7684\uff09\u53d8\u91cf\u4f5c\u4e3anginx\u7684\u53d8\u91cf\u3002<\/p>\n<p>\u6bcf\u5f53\u8bf7\u6c42\u7ed3\u675f\u65f6\uff0c\u8be5\u53d8\u91cf\u5c06\u4ece\u5185\u5b58\u4e2d\u91ca\u653e\uff0c\u56e0\u6b64\u5982\u679c\u60f3\u8981\u8de8\u8bf7\u6c42\u4fdd\u7559\u8be5\u53d8\u91cf\uff0c\u8bf7\u5c06\u5176\u4fdd\u5b58\u5728ngx.shared.DICT\u4e2d\u3002<\/p>\n<h3>ngx.ctx \u662fNginx\u4e2d\u7684\u4e0a\u4e0b\u6587\u8868\uff0c\u7528\u4e8e\u5b58\u50a8\u548c\u5171\u4eab\u8bf7\u6c42\u7ea7\u522b\u7684\u6570\u636e\u3002<\/h3>\n<p>\u60a8\u53ef\u4ee5\u50cf\u4f7f\u7528 ngx.var.VARIABLE \u4e00\u6837\u4f7f\u7528\u5b83\u4f5c\u4e3a\u5728\u8bf7\u6c42\u5185\u5171\u4eab\u7684\u53d8\u91cf\uff0c\u4f46\u5b83\u4e0d\u662fnginx\u53d8\u91cf\uff0c\u6240\u4ee5\u65e0\u9700\u5728nginx.conf\u4e2d\u9884\u5148\u58f0\u660e\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5c3d\u7ba1\u5728\u8bf7\u6c42\u4e2d\u8fdb\u884c\u5171\u4eab\uff0c\u4f46\u662f\u5728\u4e0b\u8ff0\u7684\u5b50\u8bf7\u6c42\u4e2d\u4f1a\u88ab\u4f5c\u4e3a\u4e0d\u540c\u7684\u8303\u56f4\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<h3>ngx.shared.DICT \u53ef\u4ee5\u88ab\u7528\u4f5c\u5728Nginx\u670d\u52a1\u5668\u4e2d\u5171\u4eab\u6570\u636e\u7684\u5b57\u5178\u3002<\/h3>\n<p>\u5728nginx\u4e2d\uff0c\u53ef\u4ee5\u5171\u4eab\u7684\u53d8\u91cf\u53ef\u4ee5\u7528\u4f5c\u952e\u503c\u5b58\u50a8\uff08Key Value Store\uff09\uff0c\u8d85\u8d8a\u4e86\u8bf7\u6c42\u548c\u5de5\u4f5c\u8fdb\u7a0b\u7684\u8303\u56f4\u3002\u53ef\u4ee5\u4f7f\u7528get\u3001set\u3001add\u3001replace\u3001incr\u3001delete\u3001flush_all\u3001flush_expired\u3001get_keys\u7b49\u65b9\u6cd5\uff0c\u975e\u5e38\u65b9\u4fbf\u3002\u8fd8\u53ef\u4ee5\u6dfb\u52a0expire\u7b49\u529f\u80fd\uff0c\u6240\u4ee5\u9664\u4e86\u5197\u4f59\u914d\u7f6e\u5916\uff0c\u4e5f\u53ef\u4ee5\u7528\u5b83\u6765\u66ff\u4ee3memcache\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5fc5\u987b\u4e8b\u5148\u4f7f\u7528lua_shared_dict\u8fdb\u884c\u58f0\u660e\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u58f0\u660e\u5927\u5c0f\uff0c\u4ee5\u4fbf\u9884\u5148\u8bbe\u5b9a\u6700\u5927\u5927\u5c0f\u3002<\/p>\n<p>\u8fd9\u4e2a\u53d8\u91cf\u4f1a\u5728\u91cd\u65b0\u52a0\u8f7dnginx\u914d\u7f6e\u540e\u4fdd\u6301\u4e0d\u53d8\uff0c\u4f46\u662f\u4e00\u65e6\u91cd\u65b0\u542f\u52a8\u6216\u8005\u63a5\u6536\u5230SIGHUP\u4fe1\u53f7\uff0c\u5b83\u4f1a\u88ab\u6e05\u9664\u3002<\/p>\n<h3>ngx.location.capture (\u4f7f\u7528\u6307\u4ee4)<\/h3>\n<p>\u4f7f\u7528\u8fd9\u4e2a\u53ef\u4ee5\u53d1\u9001\u5b50\u8bf7\u6c42\u3002\u4f46\u4e0d\u80fd\u8bf7\u6c42\u4efb\u610f\u7684 URL\uff0c\u53ea\u80fd\u8bf7\u6c42 nginx \u5185\u90e8\u7684\u8bf7\u6c42\u3002<\/p>\n<p>\u867d\u7136\u5982\u6b64\uff0c\u4f8b\u5982\uff0c\u5982\u679c\u6309\u7167\u4e0b\u9762\u8fd9\u6837\u5728nginx\u4e2d\u8fdb\u884c\u914d\u7f6e\uff0c\u90a3\u4e48\u5bf9\u4e8e\u5185\u90e8\u7684\/auth\u8bf7\u6c42\u4f1a\u88ab\u4ee3\u7406\u5230\u5916\u90e8\u5e76\u4f5c\u4e3a\u5916\u90e8\u8bf7\u6c42\u8fdb\u884c\u5904\u7406\uff0c\u4ece\u800c\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u9ad8\u5ea6\u7075\u6d3b\u7684\u63a5\u53e3\u8fdb\u884c\u4f7f\u7528\u3002<\/p>\n<pre class=\"post-pre\"><code>       location \/auth {\r\n           proxy_pass http:\/\/example.com\/auth\/;\r\n           proxy_redirect default;\r\n       }\r\n\r\n        location \/foo {\r\n            access_by_lua '\r\n               res = ngx.location.capture(\"\/auth\", { share_all_vars = true });  \r\n                ...\r\n            ';\r\n        }\r\n<\/code><\/pre>\n<p>\u5728ngx.location.capture\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6307\u5b9amethod\uff0cbody\u548cargs\uff0c\u60a8\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u5b50\u8bf7\u6c42\u7aef\u7684ngx.ctx\u6216ngx.vars\uff0c\u4ece\u800c\u53ef\u4ee5\u4f20\u9012\u5404\u79cd\u6570\u636e\u3002<br \/>\n\u8fd4\u56de\u503c\u662f\u4e00\u4e2a\u7531status\uff0cheader\u548cbody\u7ec4\u6210\u7684\u8868\uff0c\u901a\u8fc7\u9002\u5f53\u5904\u7406\u5b83\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u5185\u5bb9\u6216\u8fdb\u884c\u8bbf\u95ee\u6388\u6743\u68c0\u67e5\u3002<\/p>\n<p>\u4f7f\u7528ngx.location.capture_multi\u53ef\u4ee5\u5c06\u591a\u4e2a\u8bf7\u6c42\u5e76\u884c\u53d1\u9001\u3002<\/p>\n<p>\u4f7f\u7528ngx.is_subrequest\u53ef\u4ee5\u68c0\u67e5\u4e00\u4e2a\u8bf7\u6c42\u662f\u5426\u4e3a\u5b50\u8bf7\u6c42\uff0c\u4ece\u800c\u53ef\u4ee5\u963b\u6b62\u6765\u81ea\u5916\u90e8\u5bf9\u5185\u90e8\u8def\u5f84\u7684\u8bf7\u6c42\u3002<\/p>\n<p>\u6211\u4eec\u8fd8\u63d0\u4f9b\u4e86\u7528\u4e8eURI\u7684\u8f6c\u4e49\/\u53cd\u8f6c\u4e49\u548c\u53c2\u6570\u7684\u7f16\u7801\/\u89e3\u7801\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u6784\u5efaHTTP\u8bf7\u6c42\uff0c\u800c\u65e0\u9700\u592a\u591a\u56f0\u6270\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.excape_uri\/unescape_uri<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">ngx.encode_args\/decode_args<\/ul>\n<h3>ngx.header.HEADER can be paraphrased as &#8220;ngx.header.HEADER\u53ef\u4ee5\u88ab\u91cd\u8ff0\u4e3a&#8221;<\/h3>\n<p>\u6211\u4eec\u4fdd\u5b58\u4e86\u5bf9\u8bf7\u6c42\u7684\u54cd\u5e94\u5934\u3002\u60a8\u4e5f\u53ef\u4ee5\u5728\u8fd9\u91cc\u8fdb\u884c\u66f4\u6539\u6216\u6dfb\u52a0\uff0c\u56e0\u6b64\uff0c\u5982\u679c\u5c06\u5176\u653e\u5728Web\u5e94\u7528\u7a0b\u5e8f\u7684\u524d\u7aef\uff0c\u60a8\u53ef\u4ee5\u8fdb\u884cCORS\u7b49\u64cd\u4f5c\uff0c\u800c\u65e0\u9700\u66f4\u6539Web\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u5173\u4e8e\u8bf7\u6c42\u5934\uff0c\u53ef\u4ee5\u4f7f\u7528ngx.req.get_headers\u6765\u8bbf\u95ee\u3002<\/p>\n<h3>ngx.req\u662fOpenResty\u4e2d\u7684\u4e00\u4e2a\u6a21\u5757\uff0c\u5b83\u7684\u4e3b\u8981\u529f\u80fd\u5305\u62ec\uff1a\uff08\u8bf7\u6839\u636e\u5177\u4f53\u9700\u6c42\u53d6\u51b3\u4e8e\u4e0b\u4e00\u884c\u5b9e\u9645\u51fd\u6570\u540d\u79f0\uff09<\/h3>\n<p>1. \u83b7\u53d6\u8bf7\u6c42\u6570\u636e\uff08\u4f8b\u5982\uff1angx.req.get_uri_args\u83b7\u53d6URI\u53c2\u6570\uff0cngx.req.get_headers\u83b7\u53d6\u8bf7\u6c42\u5934\u4fe1\u606f\uff09<br \/>\n2. \u53d1\u9001\u5b50\u8bf7\u6c42\uff08\u4f8b\u5982\uff1angx.req.start\u662f\u53d1\u9001\u5b50\u8bf7\u6c42\u7684\u524d\u63d0\u51fd\u6570\uff09<br \/>\n3. \u8bfb\u53d6\u8bf7\u6c42\u4f53\u6570\u636e\uff08\u4f8b\u5982\uff1angx.req.read_body\u8bfb\u53d6\u8bf7\u6c42\u4f53\u6570\u636e\uff0cngx.req.get_post_args\u83b7\u53d6POST\u53c2\u6570\uff09<br \/>\n\u7b49\u7b49\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.req.start_time: \u30ea\u30af\u30a8\u30b9\u30c8\u30b9\u30bf\u30fc\u30c8\u6642\u9593<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.req.get_method: GET\u3068\u304b POST\u3068\u304b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.req.get_uri_args: query \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u53d6\u5f97<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.req.get_post_args: POST\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u53d6\u5f97<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.req.get_headers: \u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u306e\u53d6\u5f97<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">ngx.req.read_body: Body \u306e\u53d6\u5f97<\/ul>\n<p>\u9664\u4e86get\uff0c\u8fd8\u53ef\u4ee5\u8fdb\u884cset\uff0c\u56e0\u6b64\u8fd8\u6709\u5f88\u591a\u5176\u4ed6\u7684\u6539\u5199\u9009\u9879\u3002<\/p>\n<h3>\u5176\u4ed6\u5404\u79cd\u5404\u6837<\/h3>\n<h4>ngx.exec<\/h4>\n<p>\u5c06\u8bf7\u6c42\u91cd\u5b9a\u5411\u5230\u5185\u90e8\u4f4d\u7f6e\u3002\u4e0d\u8fc7\u8fd9\u4e2a\u91cd\u5b9a\u5411\u5e76\u4e0d\u662f\u50cf302\u4e00\u6837\u56de\u5230\u6d4f\u89c8\u5668\uff0c\u800c\u662f\u4f5c\u4e3anginx\u5185\u90e8\u5904\u7406\u7684\u91cd\u5b9a\u5411\u3002<\/p>\n<h4>ngx.redirect \u53ef\u4ee5\u88ab\u7ffb\u8bd1\u4e3a &#8220;ngx\u91cd\u5b9a\u5411&#8221;\u3002<\/h4>\n<p>\u5f53\u9700\u8981\u8fdb\u884c301\u6216302\u91cd\u5b9a\u5411\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u3002<\/p>\n<h4>ngx.print \/ ngx.say \u53ef\u4ee5\u5728\u4e2d\u56fd\u4f7f\u7528\u3002<\/h4>\n<p>\u5c06\u5b57\u7b26\u4e32\u5199\u5165\u54cd\u5e94\u4f53\u3002<\/p>\n<h4>ngx.log (\u5199\u5165\u65e5\u5fd7)<\/h4>\n<p>\u5c06\u65e5\u5fd7\u5199\u5165\u5230 error.log \u6587\u4ef6\u4e2d\u3002\u5e0c\u671b\u80fd\u591f\u5199\u5165\u5230\u9664\u4e86 error.log \u4e4b\u5916\u7684\u5176\u4ed6\u6587\u4ef6\u4e5f\u53ef\u4ee5&#8230;<\/p>\n<h4>\u6b63\u5e38\u9000\u51fa\u3002<\/h4>\n<p>\u6267\u884c\u7ed3\u675f\u540e\uff0c\u5e26\u4e0a\u54cd\u5e94\u72b6\u6001\u7801\u8fd4\u56de\u54cd\u5e94\u3002<\/p>\n<h4>\u65f6\u95f4\u5173\u7cfb<\/h4>\n<p>\u6709\u5f88\u591a\u4e1c\u897f\u5462..<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.today<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.time<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.now<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.localtime<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.utctime<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.cookietime : Cookie \u306e Expire \u7528<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.http_time : HTTP\u30d8\u30c3\u30c0\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5909\u63db<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">ngx.parse_http_time : HTTP\u30d8\u30c3\u30c0\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092Parse<\/ul>\n<h4>\u6587\u5b57\u4e32\u76f8\u5173<\/h4>\n<p>\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5e93\uff0cLua\u672c\u8eab\u6ca1\u6709\u7684\u4ee5\u4e0b\u51fd\u6570\u53ef\u7528\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.re.match<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.re.gmatch<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.re.find<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ngx.re.sub<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">ngx.re.gsub<\/ul>\n<h4>ngx.socket.udp\uff0cngx.socket.tcp<\/h4>\n<p>\u770b\u8d77\u6765\u53ef\u4ee5\u4f7f\u7528UDP\/TCP\u7ea7\u522b\u7684\u5957\u63a5\u5b57\u901a\u4fe1\u3002<br \/>\n\u5e94\u8be5\u662f\u4f7f\u7528\u5b83\u6765\u521b\u5efa\u4e0ememcache\u6216mysql\u8fdb\u884c\u901a\u4fe1\u7684\u6a21\u5757\u3002<\/p>\n<p>\u5982\u679c\u5728\u5197\u957f\u7684\u914d\u7f6e\u4e2d\uff0c\u53ea\u6709\u5728\u76f8\u540c\u7684nginx\u670d\u52a1\u5668\u4e0a\u624d\u4f1a\u5171\u4eab\u7684\u8bdd\uff0c\u53ef\u4ee5\u4f7f\u7528ngx.shared.DICT\u6765\u5b9e\u73b0\u4f1a\u8bdd\u7ba1\u7406\u7b49\u529f\u80fd\u3002<\/p>\n<h4>ngx.thread\u7684\u4e2d\u6587\u91ca\u4e49\u662f\u201cNginx\u7684\u7ebf\u7a0b\u201d\u3002<\/h4>\n<p>\u4f3c\u4e4e\u8fd8\u53ef\u4ee5\u521b\u5efa\u7ebf\u7a0b\u3002<\/p>\n<h4>\u534f\u7a0b<\/h4>\n<p>\u597d\u50cf\u53ef\u4ee5\u521b\u5efaLua\u7684\u534f\u7a0b\u3002<\/p>\n<h2>Please provide the text that needs to be paraphrased in Chinese.<\/h2>\n<p>\u6709\u8bb8\u591a\u65b9\u4fbf\u6613\u7528\u7684API\u4f9b\u6211\u4eec\u4f7f\u7528\uff0c\u5e76\u4e14\u53ef\u4ee5\u5e94\u7528\u4e8e\u5404\u79cd\u4e0d\u540c\u7684\u573a\u666f\u3002<\/p>\n<p>\u901a\u8fc7\u5c06\u5176\u6dfb\u52a0\u5230\u73b0\u6709\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u524d\u7aef\uff0c\u53ef\u4ee5\u5b9e\u73b0 Single Sign On\uff0c\u4e5f\u53ef\u4ee5\u5b9e\u73b0 CORS \u652f\u6301\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5728\u90e8\u5206\u8bf7\u6c42\u4e2d\u5c40\u90e8\u4fee\u6539 Body \u8fdb\u884c A\/B \u6d4b\u8bd5\uff0c\u6216\u8005\u8fdb\u884c API \u8c03\u7528\u6b21\u6570\u7684\u4e0a\u9650\u7ba1\u7406\u7b49\u64cd\u4f5c\u3002<\/p>\n<p>\u5982\u679c\u80fd\u5728\u8fd9\u4e00\u5c42\u5b9e\u73b0\uff0c\u90a3\u4e48\u65e0\u8bba\u540e\u7eed\u7684Web\u5e94\u7528\u662f\u7528Java\u3001Ruby\u8fd8\u662fPHP\uff0c\u90fd\u53ef\u4ee5\u4ee5\u76f8\u540c\u7684\u65b9\u5f0f\u4f7f\u7528\uff0c\u8fd9\u4e00\u70b9\u771f\u662f\u4ee4\u4eba\u9ad8\u5174\u3002<br \/>\n\u5982\u679c\u6709\u673a\u4f1a\u7684\u8bdd\uff0c\u4e00\u5b9a\u8981\u8bd5\u4e00\u8bd5&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uff082016.3\u66f4\u65b0\uff09 \u6211\u5927\u7ea6\u4e24\u5e74\u524d\u5199\u7684\u90a3\u7bc7\u6587\u7ae0\uff0c\u5c3d\u7ba1\u4e0e\u5f53\u65f6\u76f8\u6bd4\uff0cnginx\u7684\u7248\u672c\u5df2\u7ecf\u63d0\u5347\u4e86\uff0c\u4f46\u4f3c\u4e4e\u4ecd\u7136\u6709\u4eba\u5076\u5c14 [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-34590","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u719f\u7ec3\u8fd0\u7528lua-nginx-module - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u719f\u7ec3\u8fd0\u7528lua-nginx-module\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u719f\u7ec3\u8fd0\u7528lua-nginx-module\" \/>\n<meta property=\"og:description\" content=\"\uff082016.3\u66f4\u65b0\uff09 \u6211\u5927\u7ea6\u4e24\u5e74\u524d\u5199\u7684\u90a3\u7bc7\u6587\u7ae0\uff0c\u5c3d\u7ba1\u4e0e\u5f53\u65f6\u76f8\u6bd4\uff0cnginx\u7684\u7248\u672c\u5df2\u7ecf\u63d0\u5347\u4e86\uff0c\u4f46\u4f3c\u4e4e\u4ecd\u7136\u6709\u4eba\u5076\u5c14 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u719f\u7ec3\u8fd0\u7528lua-nginx-module\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-21T11:24:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T04:51:02+00:00\" \/>\n<meta name=\"author\" content=\"\u6587, \u7fd4\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6587, \u7fd4\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/\",\"name\":\"\u719f\u7ec3\u8fd0\u7528lua-nginx-module - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-12-21T11:24:55+00:00\",\"dateModified\":\"2024-04-30T04:51:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u719f\u7ec3\u8fd0\u7528lua-nginx-module\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c\",\"name\":\"\u6587, \u7fd4\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g\",\"caption\":\"\u6587, \u7fd4\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/wenxiang\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u719f\u7ec3\u8fd0\u7528lua-nginx-module - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u719f\u7ec3\u8fd0\u7528lua-nginx-module\/","og_locale":"zh_CN","og_type":"article","og_title":"\u719f\u7ec3\u8fd0\u7528lua-nginx-module","og_description":"\uff082016.3\u66f4\u65b0\uff09 \u6211\u5927\u7ea6\u4e24\u5e74\u524d\u5199\u7684\u90a3\u7bc7\u6587\u7ae0\uff0c\u5c3d\u7ba1\u4e0e\u5f53\u65f6\u76f8\u6bd4\uff0cnginx\u7684\u7248\u672c\u5df2\u7ecf\u63d0\u5347\u4e86\uff0c\u4f46\u4f3c\u4e4e\u4ecd\u7136\u6709\u4eba\u5076\u5c14 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u719f\u7ec3\u8fd0\u7528lua-nginx-module\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-12-21T11:24:55+00:00","article_modified_time":"2024-04-30T04:51:02+00:00","author":"\u6587, \u7fd4","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6587, \u7fd4","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/","name":"\u719f\u7ec3\u8fd0\u7528lua-nginx-module - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-12-21T11:24:55+00:00","dateModified":"2024-04-30T04:51:02+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u719f\u7ec3\u8fd0\u7528lua-nginx-module"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c","name":"\u6587, \u7fd4","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g","caption":"\u6587, \u7fd4"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/wenxiang\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%86%9f%e7%bb%83%e8%bf%90%e7%94%a8lua-nginx-module\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=34590"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34590\/revisions"}],"predecessor-version":[{"id":92014,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34590\/revisions\/92014"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=34590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=34590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=34590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}