{"id":1491,"date":"2023-03-24T22:50:08","date_gmt":"2023-03-24T14:50:08","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1491"},"modified":"2023-04-28T20:29:35","modified_gmt":"2023-04-28T12:29:35","slug":"verynginx-installation-and-use","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/24\/verynginx-installation-and-use\/","title":{"rendered":"VeryNginx\u5b89\u88c5\u53ca\u4f7f\u7528"},"content":{"rendered":"<h2>VeryNginx\u7b80\u4ecb<\/h2>\n<p>VeryNginx \u57fa\u4e8e lua_nginx_module(openrestry) \u5f00\u53d1\uff0c\u5b9e\u73b0\u4e86\u9ad8\u7ea7\u7684\u9632\u706b\u5899\u3001\u8bbf\u95ee\u7edf\u8ba1\u548c\u5176\u4ed6\u7684\u4e00\u4e9b\u529f\u80fd\u3002 \u96c6\u6210\u5728 Nginx \u4e2d\u8fd0\u884c\uff0c\u6269\u5c55\u4e86 Nginx \u672c\u8eab\u7684\u529f\u80fd\uff0c\u5e76\u63d0\u4f9b\u4e86\u53cb\u597d\u7684 Web \u4ea4\u4e92\u754c\u9762\u3002<\/p>\n<p><!-- more --><\/p>\n<p>Github\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/alexazhou\/VeryNginx\">https:\/\/github.com\/alexazhou\/VeryNginx<\/a><br \/>\nVeryNginx\u5728\u7ebf\u5b9e\u4f8b\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/alexazhou.xyz\/vn\/index.html\">http:\/\/alexazhou.xyz\/vn\/index.html<\/a> \uff08\u7528\u6237\u540d\/\u5bc6\u7801: verynginx\/verynginx\uff09<br \/>\nVeryNginx Github WiKi\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/alexazhou\/VeryNginx\/wiki\/%E7%9B%AE%E5%BD%95\">https:\/\/github.com\/alexazhou\/VeryNginx\/wiki\/%E7%9B%AE%E5%BD%95<\/a><\/p>\n<blockquote>\n<p>v0.2 \u7248\u672c\u4e4b\u540e\uff0c\u63a7\u5236\u53f0\u5165\u53e3\u88ab\u79fb\u52a8\u5230 <code>\/verynginx\/index.html<\/code><\/p>\n<\/blockquote>\n<h3>Nginx \u8fd0\u884c\u72b6\u6001\u5206\u6790<\/h3>\n<ul>\n<li>\u6bcf\u79d2\u8bf7\u6c42\u6570<\/li>\n<li>\u54cd\u5e94\u65f6\u95f4<\/li>\n<li>\u7f51\u7edc\u6d41\u91cf<\/li>\n<li>\u7f51\u7edc\u8fde\u63a5\u6570<\/li>\n<\/ul>\n<h3>\u81ea\u5b9a\u4e49\u884c\u4e3a<\/h3>\n<p>VeryNginx \u5305\u542b\u5f3a\u5927\u7684\u81ea\u5b9a\u4e49\u529f\u80fd\uff0c\u81ea\u5b9a\u4e49\u884c\u4e3a\u5305\u542b\u4e24\u90e8\u5206\uff0c<code>Matcher<\/code>\u548c<code>Action<\/code>\u3002Matcher\u7528\u6765\u5bf9\u8bf7\u6c42\u8fdb\u884c\u5339\u914d\uff0cAction\u4e3a\u8981\u6267\u884c\u7684\u52a8\u4f5c<\/p>\n<p>\u8fd9\u6837\u7684\u4f18\u52bf\u5728\u4e8e\u628a\u6240\u6709\u7684\u524d\u7f6e\u5224\u65ad\u6574\u5408\u5728Matcher\u91cc\u4e00\u8d77\u5b9e\u73b0\uff0c\u4f7f\u590d\u6742(\u7ec4\u5408)\u89c4\u5219\u7684\u5b9e\u73b0\u53d8\u6210\u53ef\u80fd<\/p>\n<p>\uff081\uff09Matcher<\/p>\n<p>\u4e00\u4e2a Matcher \u7528\u6765\u5224\u65ad\u4e00\u4e2a Http \u8bf7\u6c42\u662f\u5426\u7b26\u5408\u6307\u5b9a\u7684\u6761\u4ef6\uff0c\u4e00\u4e2a Matcher \u53ef\u4ee5\u5305\u542b\u4e00\u4e2a\u6216\u8005\u591a\u4e2a\u7ea6\u675f\u6761\u4ef6\uff0c\u76ee\u524d\u652f\u6301\u4ee5\u4e0b\u51e0\u79cd\u7ea6\u675f\uff1a<\/p>\n<ul>\n<li>Client IP<\/li>\n<li>Host<\/li>\n<li>UserAgent<\/li>\n<li>URI<\/li>\n<li>Referer<\/li>\n<li>Request Args<\/li>\n<\/ul>\n<p>\u5f53\u4e00\u4e2a\u8bf7\u6c42\u6ca1\u6709\u8fdd\u53cd Matcher \u4e2d\u5305\u542b\u7684\u5168\u90e8\u6761\u4ef6\u65f6\uff0c\u5373\u547d\u4e2d\u8fd9\u4e2a Matcher<\/p>\n<p>\uff082\uff09Action<\/p>\n<p>\u6bcf\u4e2a Action \u4f1a\u5f15\u7528\u4e00\u4e2a Matcher\uff0c\u5f53 Matcher \u547d\u4e2d\u65f6\uff0cAction \u4f1a\u88ab\u6267\u884c<\/p>\n<p>\u76ee\u524d\u5df2\u7ecf\u5b9e\u73b0\u4ee5\u4e0b Action<\/p>\n<ul>\n<li><code>Scheme Lock<\/code> \u5c06\u8bbf\u95ee\u534f\u8bae\u9501\u5b9a\u4e3a Https \u6216\u8005 Http<\/li>\n<li><code>Redirect<\/code> \u5bf9\u8bf7\u6c42\u8fdb\u884c\u91cd\u5b9a\u5411<\/li>\n<li><code>URI Rewrite<\/code> \u5bf9\u8bf7\u6c42\u7684 URI \u8fdb\u884c\u5185\u90e8\u91cd\u5199<\/li>\n<li><code>Browser Verify<\/code> \u901a\u8fc7set-cookies \u548c js \u9a8c\u8bc1\u5ba2\u6237\u7aef\u662f\u5426\u4e3a\u6d4f\u89c8\u5668\uff0c\u5e76\u62e6\u622a\u975e\u6d4f\u89c8\u5668\u6d41\u91cf\u3002\u672c\u529f\u80fd\u53ef\u80fd\u4f1a\u963b\u62e6\u641c\u7d22\u5f15\u64ce\u722c\u866b\uff0c\u5efa\u8bae\u4ec5\u5728\u88ab\u653b\u51fb\u65f6\u5f00\u542f\uff0c\u6216\u8005\u9488\u5bf9\u641c\u7d22\u5f15\u64ce\u7f16\u5199\u7279\u522b\u7684\u89c4\u5219<\/li>\n<li><code>Frequency Limit<\/code> \u8bbf\u95ee\u9891\u7387\u9650\u5236<\/li>\n<li><code>Filter(waf)<\/code> \u8fc7\u6ee4\u5668<\/li>\n<\/ul>\n<p>\u56e0\u4e3a Matcher \u53ef\u4ee5\u5bf9\u8bf7\u6c42\u8fdb\u884c\u7ec6\u81f4\u7684\u5339\u914d\uff0c\u6240\u4ee5\u7ed3\u5408 Filter Action\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e00\u4e2a\u9ad8\u7ea7\u7684WAF\uff0c\u53ef\u4ee5\u5229\u7528Matcher\u4e2d\u6240\u6709\u7684\u6761\u4ef6\u6765\u5bf9\u8bf7\u6c42\u8fdb\u884c\u8fc7\u6ee4\uff0c\u5e76\u8fd4\u56de\u6307\u5b9a\u72b6\u6001\u7801<\/p>\n<p>VeryNginx \u9884\u7f6e\u4e86\u5e38\u7528\u7684\u8fc7\u6ee4\u89c4\u5219\uff0c\u53ef\u4ee5\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u963b\u6b62\u5e38\u89c1\u7684 SQL \u6ce8\u5165\u3001Git \u53ca SVN \u6587\u4ef6\u6cc4\u9732\u3001\u76ee\u5f55\u904d\u5386\u653b\u51fb\uff0c\u5e76\u62e6\u622a\u5e38\u89c1\u7684\u626b\u63cf\u5de5\u5177\u3002<\/p>\n<p>\uff083\uff09Backend<\/p>\n<p>\u6bcf\u4e2a Backend \u4f1a\u5f15\u7528\u4e00\u4e2a Matcher\uff0c\u5f53 Matcher \u547d\u4e2d\u65f6\uff0c\u8bf7\u6c42\u4f1a\u901a\u8fc7 Backend \u8fdb\u884c\u5904\u7406<\/p>\n<p>\u76ee\u524d\u5df2\u7ecf\u5b9e\u73b0\u4ee5\u4e0b Backend<\/p>\n<ul>\n<li><code>Proxy Pass<\/code> \u5c06\u8bf7\u6c42\u53cd\u5411\u4ee3\u7406\u5230\u5176\u5b83\u670d\u52a1\u5668<\/li>\n<li><code>Static File<\/code> \u4f7f\u7528\u672c\u5730\u6587\u4ef6\u5904\u7406\u8bf7\u6c42<\/li>\n<\/ul>\n<h2>\u5b89\u88c5\u548c\u4f7f\u7528\u8bf4\u660e<\/h2>\n<p>VeryNginx \u81ea\u8eab\u63d0\u4f9b\u4e86\u811a\u672c\u6765\u8fdb\u884c\u5b89\u88c5\u5de5\u4f5c<\/p>\n<h3>\u5b89\u88c5 VeryNginx<\/h3>\n<p>\u514b\u9686 VeryNginx \u4ed3\u5e93\u5230\u672c\u5730, \u7136\u540e\u8fdb\u5165\u4ed3\u5e93\u76ee\u5f55\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4<\/p>\n<pre><code>python install.py install  \/\/\u53ea\u5b89\u88c5VeryNginx\u53caOpenResty\npython install.py install verynginx  \/\/\u53ea\u5b89\u88c5VeryNginx<\/code><\/pre>\n<p>\u5373\u53ef\u4e00\u952e\u5b89\u88c5 VeryNginx \u548c \u4ee5\u53ca\u4f9d\u8d56\u7684 OpenResty<\/p>\n<h3>\u4f7f\u7528\u81ea\u5df1\u7684 Nginx<\/h3>\n<p>VeryNginx \u53ef\u4ee5\u81ea\u52a8\u5b89\u88c5\u4f9d\u8d56\u7684 OpenResty\uff0c\u901a\u5e38\u60c5\u51b5\u4e0b\u6ca1\u6709\u5fc5\u8981\u518d\u81ea\u5df1\u5b89\u88c5 OpenResty\u3002<\/p>\n<p>\u4f46\u5982\u679c\u60f3\u8981\u4f7f\u7528\u81ea\u5df1\u7f16\u8bd1\u7684 Nginx(OpenResty)\uff0c\u4e5f\u662f\u53ef\u4ee5\u7684\u3002\u5177\u4f53\u65b9\u6cd5\u8bf7\u9605\u8bfbWiki\u4e2d\u7684\u8fd9\u7bc7\u8bf4\u660e\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/alexazhou\/VeryNginx\/wiki\/Use-own-nginx\" title=\"Use own nginx\">Use own nginx<\/a><\/p>\n<pre><code># vim \/usr\/local\/nginx\/conf\/nginx.conf\n# nginx -s reload<\/code><\/pre>\n<pre><code># \u5728 \u5168\u5c40 \u914d\u7f6e\u6bb5\u4e2d\u52a0\u5165\ninclude \/opt\/verynginx\/verynginx\/nginx_conf\/in_external.conf;\nhttp {\n    # \u5728 http \u914d\u7f6e\u6bb5\u4e2d\u52a0\u5165\n    include \/opt\/verynginx\/verynginx\/nginx_conf\/in_http_block.conf;\n    server {\n        listen       80; \n        server_name  localhost; \n        # \u5728 server \u914d\u7f6e\u6bb5\u4e2d\u52a0\u5165\n        include \/opt\/verynginx\/verynginx\/nginx_conf\/in_server_block.conf;\n     }\n\uff5d<\/code><\/pre>\n<h2>\u767b\u5f55 VeryNginx<\/h2>\n<p>VeryNginx \u542f\u52a8\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u7ba1\u7406\u9762\u677f\u6765\u67e5\u770b\u72b6\u6001\u4ee5\u53ca\u8fdb\u884c\u914d\u7f6e<\/p>\n<p>\u8bbf\u95ee\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/server_address\/verynginx\/index.html\">http:\/\/server_address\/verynginx\/index.html<\/a><\/p>\n<p>\u9ed8\u8ba4\u7528\u6237\u540d\u548c\u5bc6\u7801\u90fd\u662f verynginx<\/p>\n<p>\u5728\u8fd9\u4e2aDashboard\u4e2d\uff0c\u53ef\u89c1\u5230\u76ee\u524dTCP\u8fde\u63a5\u6570\u53ca\u54cd\u5e94\u65f6\u95f4\u548c\u7f51\u7edc\u6d41\u91cf\u7b49\u76f8\u5173\u6570\u503c\uff0c\u5728Config\u4e2d\u4e5f\u53ef\u4ee5\u6839\u636e\u76f8\u5e94\u7528\u6237\u8bf7\u6c42\u8fdb\u884c\u8fdb\u884c\u4e00\u4e9b\u89c4\u5219\u5339\u914d\u5b9e\u73b0\u81ea\u5b9a\u4e49\u9632\u706b\u5899\u7684\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VeryNginx\u7b80\u4ecb VeryNginx \u57fa\u4e8e lua_nginx_module(openrestry) \u5f00 [&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":[366],"class_list":["post-1491","post","type-post","status-publish","format-standard","hentry","category-nginx","tag-verynginx"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1491","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=1491"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1491\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}