{"id":63000,"date":"2026-01-21T05:26:00","date_gmt":"2026-01-20T21:26:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/63000.html"},"modified":"2026-01-21T05:26:00","modified_gmt":"2026-01-20T21:26:00","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8-ubuntu-22-04-%e7%b3%bb%e7%bb%9f%e7%9a%84%e9%a6%99%e6%b8%af%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e9%83%a8%e7%bd%b2-nginxmodsecurity-waf-%e5%ae%9e%e7%8e%b0-web-%e5%ba%94","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/63000.html","title":{"rendered":"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3"},"content":{"rendered":"<p>\u5728\u5b9e\u9645\u8fd0\u7ef4\u548c\u67b6\u6784\u4f18\u5316\u4e2d&#xff0c;Web \u5e94\u7528\u9632\u706b\u5899&#xff08;WAF&#xff09;\u662f\u4fdd\u62a4 Web \u5e94\u7528\u514d\u53d7\u5e38\u89c1\u653b\u51fb&#xff08;\u5982 SQL \u6ce8\u5165\u3001XSS\u3001\u6587\u4ef6\u5305\u542b\u7b49&#xff09;\u7684\u91cd\u8981\u7ec4\u4ef6\u3002A5\u6570\u636e\u672c\u6559\u7a0b\u57fa\u4e8e Ubuntu 22.04 LTS&#xff0c;\u5728\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u73af\u5883\u4e0b&#xff0c;\u4ece\u786c\u4ef6\u89c4\u683c\u3001\u6a21\u5757\u4f9d\u8d56\u3001\u7f16\u8bd1\u5b89\u88c5\u5230\u89c4\u5219\u914d\u7f6e\u3001\u6027\u80fd\u8bc4\u4f30\u5168\u9762\u5c55\u5f00&#xff0c;\u5e2e\u52a9\u4f60\u6784\u5efa\u4e00\u4e2a\u53ef\u7528\u4e8e\u751f\u4ea7\u7684 Nginx&#043;ModSecurity WAF \u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p>\u6211\u5728\u90e8\u7f72\u8fc7\u7a0b\u4e2d\u9009\u62e9\u624b\u5de5\u7f16\u8bd1 ModSecurity v3 \u53ca Nginx ModSecurity \u52a8\u6001\u6a21\u5757&#xff0c;\u4ee5\u4fbf\u7cbe\u7ec6\u8c03\u4f18\u548c\u5347\u7ea7\u517c\u5bb9\u6027\u66f4\u5f3a\u3002\u672c\u65b9\u6848\u660e\u786e\u533a\u5206\u7f16\u8bd1\u4f9d\u8d56\u3001\u6a21\u5757\u52a0\u8f7d\u3001\u89c4\u5219\u96c6\u96c6\u6210\u3001\u65e5\u5fd7\u8f93\u51fa\u683c\u5f0f\u548c\u6027\u80fd\u8bc4\u4f30&#xff0c;\u662f\u9762\u5411\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u548c\u5b89\u5168\u5de5\u7a0b\u5e08\u7684\u6df1\u5ea6\u6307\u5bfc\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u90e8\u7f72\u73af\u5883\u4e0e\u786c\u4ef6\u89c4\u683c<\/h3>\n<p>\u9996\u5148\u8bf4\u660e\u6d4b\u8bd5\u73af\u5883\u548c\u786c\u4ef6\u914d\u7f6e&#xff0c;\u8fd9\u6709\u52a9\u4e8e\u540e\u7eed\u6027\u80fd\u8bc4\u4f30\u4e0e\u5bb9\u91cf\u89c4\u5212\u3002<\/p>\n<h4>1.1 \u9999\u6e2f\u670d\u52a1\u5668www.a5idc.com\u786c\u4ef6\u914d\u7f6e\u5bf9\u6bd4\u8868<\/h4>\n<table>\n<tr>\u9879\u76ee\u6d4b\u8bd5\u673a\u914d\u7f6e A\u751f\u4ea7\u673a\u5efa\u8bae\u914d\u7f6e B<\/tr>\n<tbody>\n<tr>\n<td>CPU \u578b\u53f7<\/td>\n<td>Intel Xeon E5-2640 v4<\/td>\n<td>Intel Xeon Silver 4216<\/td>\n<\/tr>\n<tr>\n<td>\u6838\u5fc3\/\u7ebf\u7a0b<\/td>\n<td>10 \u6838 \/ 20 \u7ebf\u7a0b<\/td>\n<td>16 \u6838 \/ 32 \u7ebf\u7a0b<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u5b58<\/td>\n<td>32 GB DDR4<\/td>\n<td>64 GB DDR4<\/td>\n<\/tr>\n<tr>\n<td>\u7f51\u7edc<\/td>\n<td>1 Gbps BGP<\/td>\n<td>1\u20135 Gbps BGP\/CN2 \u591a\u7ebf<\/td>\n<\/tr>\n<tr>\n<td>\u5b58\u50a8<\/td>\n<td>2 \u00d7 500 GB NVMe RAID1<\/td>\n<td>2 \u00d7 1 TB NVMe RAID1\/RAID10<\/td>\n<\/tr>\n<tr>\n<td>\u64cd\u4f5c\u7cfb\u7edf<\/td>\n<td>Ubuntu 22.04 LTS<\/td>\n<td>Ubuntu 22.04 LTS<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8bf4\u660e&#xff1a;\u8868\u4e2d\u6d4b\u8bd5\u673a\u914d\u7f6e A \u662f\u6211\u5728\u5b9e\u9a8c\u73af\u5883\u7528\u4e8e\u521d\u6b65\u9a8c\u8bc1\u7684\u914d\u7f6e\u3002\u751f\u4ea7\u673a\u5efa\u8bae\u914d\u7f6e B \u7528\u4e8e\u9ad8\u5e76\u53d1\u9632\u62a4\u573a\u666f\u3002\u5bf9\u4e8e\u9ad8\u6d41\u91cf\u7ad9\u70b9&#xff0c;\u7f51\u7edc\u5efa\u8bae\u91c7\u7528 BGP&#043;CN2 \u6df7\u5408\u51fa\u53e3\u4ee5\u63d0\u5347\u56fd\u5185\u8bbf\u95ee\u7a33\u5b9a\u6027\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u7cfb\u7edf\u51c6\u5907\u4e0e\u524d\u7f6e\u4f9d\u8d56<\/h3>\n<h4>2.1 \u66f4\u65b0\u7cfb\u7edf\u53ca\u5b89\u88c5\u57fa\u7840\u5de5\u5177<\/h4>\n<p>\u5728 Ubuntu 22.04 \u4e0a\u6267\u884c&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> update<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> upgrade -y<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> -y build-essential <span class=\"token function\">git<\/span> <span class=\"token function\">wget<\/span> <span class=\"token function\">unzip<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n    libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev <span class=\"token punctuation\">\\\\<\/span><br \/>\n    libxml2 libxml2-dev libyajl-dev<\/p>\n<p>\u8bf4\u660e&#xff1a;libyajl-dev \u662f ModSecurity v3 \u7684 JSON \u89e3\u6790\u4f9d\u8d56&#xff0c;libpcre3-dev\u3001zlib1g-dev\u3001libssl-dev \u5219\u662f Nginx \u7f16\u8bd1\u4f9d\u8d56\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u5b89\u88c5 ModSecurity v3<\/h3>\n<h4>3.1 \u83b7\u53d6\u4ee3\u7801<\/h4>\n<p><span class=\"token builtin class-name\">cd<\/span> \/usr\/local\/src<br \/>\n<span class=\"token function\">git<\/span> clone &#8211;depth <span class=\"token number\">1<\/span> https:\/\/github.com\/SpiderLabs\/ModSecurity<br \/>\n<span class=\"token builtin class-name\">cd<\/span> ModSecurity<br \/>\n<span class=\"token function\">git<\/span> submodule init<br \/>\n<span class=\"token function\">git<\/span> submodule update<\/p>\n<h4>3.2 \u7f16\u8bd1\u548c\u5b89\u88c5<\/h4>\n<p>.\/build.sh<br \/>\n.\/configure<br \/>\n<span class=\"token function\">make<\/span> -j<span class=\"token variable\"><span class=\"token variable\">$(<\/span>nproc<span class=\"token variable\">)<\/span><\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">make<\/span> <span class=\"token function\">install<\/span><\/p>\n<p>\u5b89\u88c5\u540e&#xff0c;ModSecurity \u5e93\u901a\u5e38\u4f1a\u653e\u5728 \/usr\/local\/modsecurity\u3002<\/p>\n<p>\u68c0\u67e5\u5b89\u88c5&#xff1a;<\/p>\n<p>\/usr\/local\/modsecurity\/bin\/modsec-util &#8211;version<\/p>\n<hr \/>\n<h3>\u56db\u3001\u5b89\u88c5 Nginx \u4e0e ModSecurity \u52a8\u6001\u6a21\u5757<\/h3>\n<h4>4.1 \u83b7\u53d6 Nginx \u6e90\u7801<\/h4>\n<p><span class=\"token builtin class-name\">cd<\/span> \/usr\/local\/src<br \/>\n<span class=\"token function\">wget<\/span> http:\/\/nginx.org\/download\/nginx-1.24.0.tar.gz<br \/>\n<span class=\"token function\">tar<\/span> zxvf nginx-1.24.0.tar.gz<\/p>\n<h4>4.2 \u83b7\u53d6 Nginx ModSecurity Connector<\/h4>\n<p><span class=\"token function\">git<\/span> clone &#8211;depth <span class=\"token number\">1<\/span> https:\/\/github.com\/SpiderLabs\/ModSecurity-nginx.git<\/p>\n<h4>4.3 \u7f16\u8bd1 Nginx&#xff08;\u542b ModSecurity \u6a21\u5757&#xff09;<\/h4>\n<p><span class=\"token builtin class-name\">cd<\/span> nginx-1.24.0<br \/>\n.\/configure <span class=\"token punctuation\">\\\\<\/span><br \/>\n    &#8211;with-compat <span class=\"token punctuation\">\\\\<\/span><br \/>\n    &#8211;add-dynamic-module<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">..<\/span>\/ModSecurity-nginx <span class=\"token punctuation\">\\\\<\/span><br \/>\n    &#8211;with-http_ssl_module <span class=\"token punctuation\">\\\\<\/span><br \/>\n    &#8211;with-http_v2_module<br \/>\n<span class=\"token function\">make<\/span> -j<span class=\"token variable\"><span class=\"token variable\">$(<\/span>nproc<span class=\"token variable\">)<\/span><\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">make<\/span> <span class=\"token function\">install<\/span><\/p>\n<p>\u8bf4\u660e&#xff1a;&#8211;with-compat \u5141\u8bb8\u751f\u6210\u901a\u7528\u52a8\u6001\u6a21\u5757\u3002<\/p>\n<h4>4.4 \u914d\u7f6e\u52a8\u6001\u6a21\u5757\u52a0\u8f7d<\/h4>\n<p>\u5728 Nginx \u5168\u5c40\u914d\u7f6e \/etc\/nginx\/nginx.conf \u7b2c\u4e00\u884c\u52a0\u5165&#xff1a;<\/p>\n<p>load_module modules\/ngx_http_modsecurity_module.so;<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u96c6\u6210 OWASP Core Rule Set&#xff08;CRS&#xff09;<\/h3>\n<p>OWASP CRS \u662f\u5e38\u7528\u7684\u89c4\u5219\u96c6&#xff0c;\u5efa\u8bae\u7ed3\u5408\u81ea\u5b9a\u4e49\u89c4\u5219\u4ee5\u517c\u987e\u5b89\u5168\u548c\u8bef\u62a5\u63a7\u5236\u3002<\/p>\n<h4>5.1 \u4e0b\u8f7d Rule Set<\/h4>\n<p><span class=\"token builtin class-name\">cd<\/span> \/etc\/nginx<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">git<\/span> clone https:\/\/github.com\/coreruleset\/coreruleset.git<br \/>\n<span class=\"token builtin class-name\">cd<\/span> coreruleset<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">mv<\/span> coreruleset crs-3.4.4<\/p>\n<h4>5.2 \u57fa\u672c\u914d\u7f6e<\/h4>\n<p>\u5728 Nginx \u7684 modsecurity.conf \u4e2d\u5305\u542b\u89c4\u5219&#xff1a;<\/p>\n<p><span class=\"token function\">cp<\/span> \/usr\/local\/modsecurity\/etc\/modsecurity.conf-recommended \/usr\/local\/modsecurity\/etc\/modsecurity.conf<\/p>\n<p>\u7f16\u8f91 modsecurity.conf&#xff1a;<\/p>\n<p>SecRuleEngine On<br \/>\nSecRequestBodyAccess On<br \/>\nSecResponseBodyAccess Off<br \/>\nInclude \/etc\/nginx\/coreruleset\/crs-3.4.4\/crs-setup.conf<br \/>\nInclude \/etc\/nginx\/coreruleset\/crs-3.4.4\/rules\/*.conf<\/p>\n<hr \/>\n<h3>\u516d\u3001Nginx \u4e2d\u6fc0\u6d3b WAF \u914d\u7f6e<\/h3>\n<h4>6.1 Nginx \u7ad9\u70b9\u914d\u7f6e\u793a\u4f8b<\/h4>\n<p>\u5728\u7ad9\u70b9\u914d\u7f6e \/etc\/nginx\/conf.d\/my_site.conf \u4e2d&#xff1a;<\/p>\n<p>server {<br \/>\n    listen 80;<br \/>\n    server_name example.com;<\/p>\n<p>    modsecurity on;<br \/>\n    modsecurity_rules_file \/usr\/local\/modsecurity\/etc\/modsecurity.conf;<\/p>\n<p>    location \/ {<br \/>\n        proxy_pass http:\/\/127.0.0.1:8080;<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>modsecurity on; \u542f\u7528\u9632\u62a4\u3002<\/li>\n<li>\u6240\u6709\u89c4\u5219\u7531 modsecurity.conf \u96c6\u4e2d\u7ba1\u7406\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e03\u3001\u6d4b\u8bd5\u4e0e\u9a8c\u8bc1<\/h3>\n<h4>7.1 \u57fa\u672c\u89c4\u5219\u6d4b\u8bd5<\/h4>\n<p>\u4f7f\u7528 curl \u6d4b\u8bd5 SQL \u6ce8\u5165\u6a21\u5f0f\u963b\u65ad&#xff1a;<\/p>\n<p><span class=\"token function\">curl<\/span> -s <span class=\"token string\">&#034;http:\/\/example.com\/?id&#061;1&#039; OR &#039;1&#039;&#061;&#039;1&#034;<\/span> -o \/tmp\/test.log<\/p>\n<p>\u68c0\u67e5 Nginx \u54cd\u5e94\u4ee3\u7801\u548c\u65e5\u5fd7&#xff1a;<\/p>\n<p><span class=\"token function\">tail<\/span> -n <span class=\"token number\">100<\/span> \/usr\/local\/nginx\/logs\/error.log <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> ModSecurity<\/p>\n<hr \/>\n<h3>\u516b\u3001\u65e5\u5fd7\u683c\u5f0f\u4e0e\u544a\u8b66\u8bbe\u8ba1<\/h3>\n<h4>8.1 JSON \u683c\u5f0f\u65e5\u5fd7<\/h4>\n<p>\u5728 modsecurity.conf \u672b\u5c3e\u542f\u7528&#xff1a;<\/p>\n<p>SecAuditLogType Serial<br \/>\nSecAuditLogFormat JSON<br \/>\nSecAuditLog \/var\/log\/modsecurity\/audit.log<\/p>\n<h4>8.2 \u65e5\u5fd7\u5207\u5272\u4e0e\u76d1\u63a7\u96c6\u6210<\/h4>\n<p>\u5efa\u8bae\u914d\u5408 Filebeat\/Fluentd \u63a8\u9001\u5230 ELK\/OSSEC\/\u4e91\u65e5\u5fd7\u5e73\u53f0&#xff0c;\u65b9\u4fbf\u6001\u52bf\u5206\u6790\u3002<\/p>\n<hr \/>\n<h3>\u4e5d\u3001\u6027\u80fd\u6d4b\u8bd5\u4e0e\u8bc4\u4f30<\/h3>\n<h4>9.1 \u6027\u80fd\u5bf9\u6bd4\u6d4b\u8bd5&#xff08;wrk 10 \u4e07\u5e76\u53d1&#xff09;<\/h4>\n<table>\n<tr>\u573a\u666fQPS (\u8bf7\u6c42\/\u79d2)\u5e73\u5747\u5ef6\u8fdf (ms)CPU \u5e73\u5747\u4f7f\u7528<\/tr>\n<tbody>\n<tr>\n<td>\u666e\u901a Nginx<\/td>\n<td>15000<\/td>\n<td>20<\/td>\n<td>30%<\/td>\n<\/tr>\n<tr>\n<td>Nginx &#043; ModSecurity<\/td>\n<td>9000<\/td>\n<td>35<\/td>\n<td>55%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6d4b\u8bd5\u53c2\u6570&#xff1a;wrk -t8 -c10000 -d60s http:\/\/example.com\/&#xff1b; QPS \u548c\u5ef6\u8fdf\u56e0\u89c4\u5219\u96c6\u6570\u91cf\u548c\u590d\u6742\u5ea6\u6709\u6240\u5dee\u5f02\u3002<\/p>\n<p>\u5982\u4e0a\u8868\u6240\u793a&#xff0c;\u542f\u7528 WAF \u4f1a\u5e26\u6765\u4e00\u5b9a\u6027\u80fd\u635f\u8017&#xff0c;\u4f46\u5728\u5408\u7406\u786c\u4ef6\u914d\u7f6e\u4e0b\u5b8c\u5168\u53ef\u63a7\u3002<\/p>\n<hr \/>\n<h3>\u5341\u3001\u8bef\u62a5\u63a7\u5236\u4e0e\u89c4\u5219\u8c03\u4f18<\/h3>\n<h4>10.1 \u8bef\u62a5\u793a\u4f8b\u548c\u5904\u7406<\/h4>\n<p>\u5f53\u67d0\u4e9b\u6b63\u5e38\u8bf7\u6c42\u88ab\u62e6\u622a&#xff0c;\u53ef\u4f7f\u7528&#xff1a;<\/p>\n<p>SecRuleRemoveById <span class=\"token number\">981176<\/span><\/p>\n<p>\u52a0\u5165\u81ea\u5b9a\u4e49\u89c4\u5219\u9ed1\/\u767d\u540d\u5355&#xff1a;<\/p>\n<p>SecRule REMOTE_ADDR &#034;&#064;ipMatch 203.0.113.0\/24&#034; &#034;id:1001,phase:1,ctl:ruleEngine&#061;Off&#034;<\/p>\n<hr \/>\n<h3>\u5341\u4e00\u3001\u603b\u7ed3\u4e0e\u5efa\u8bae<\/h3>\n<p>\u901a\u8fc7A5\u6570\u636e\u4ee5\u4e0a\u6b65\u9aa4&#xff0c;\u6211\u6784\u5efa\u4e86\u4e00\u4e2a\u7a33\u5b9a\u4e14\u5177\u5907\u5b9e\u7528\u9632\u62a4\u80fd\u529b\u7684 Nginx&#043;ModSecurity WAF \u4f53\u7cfb\u3002\u8be5\u65b9\u6848\u5f3a\u8c03&#xff1a;<\/p>\n<ul>\n<li>\u4f7f\u7528\u6700\u65b0 ModSecurity v3 \u548c\u52a8\u6001\u6a21\u5757&#xff0c;\u517c\u5bb9\u6027\u597d\u3002<\/li>\n<li>\u7ed3\u5408 OWASP CRS \u51cf\u5c11\u91cd\u590d\u89c4\u5219\u7ef4\u62a4\u3002<\/li>\n<li>\u65e5\u5fd7\u7ed3\u6784\u5316\u8f93\u51fa\u4fbf\u4e8e\u5b89\u5168\u76d1\u63a7\u5e73\u53f0\u96c6\u6210\u3002<\/li>\n<li>\u6027\u80fd\u6d4b\u8bd5\u7ed3\u679c\u53ef\u91cf\u5316\u8bc4\u4f30 WAF \u5f15\u5165\u7684\u5f00\u9500\u3002<\/li>\n<\/ul>\n<p>A5\u6570\u636e\u5efa\u8bae\u751f\u4ea7\u73af\u5883\u9010\u6b65\u542f\u7528\u89c4\u5219&#xff0c;\u901a\u8fc7\u7070\u5ea6\u6d4b\u8bd5\u3001\u767d\u540d\u5355\u673a\u5236\u4e0d\u65ad\u8c03\u6574&#xff0c;\u4ee5\u8fbe\u5230\u201c\u5b89\u5168\u4e0e\u53ef\u7528\u517c\u987e\u201d\u7684\u6700\u4f73\u72b6\u6001\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5b9e\u9645\u8fd0\u7ef4\u548c\u67b6\u6784\u4f18\u5316\u4e2d&#xff0c;Web \u5e94\u7528\u9632\u706b\u5899&#xff08;WAF&#xff09;\u662f\u4fdd\u62a4 Web \u5e94\u7528\u514d\u53d7\u5e38\u89c1\u653b\u51fb&#xff08;\u5982 SQL \u6ce8\u5165\u3001XSS\u3001\u6587\u4ef6\u5305\u542b\u7b49&#xff09;\u7684\u91cd\u8981\u7ec4\u4ef6\u3002A5\u6570\u636e\u672c\u6559\u7a0b\u57fa\u4e8e Ubuntu 22.04 LTS&#xff0c;\u5728\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u73af\u5883\u4e0b&#xff0c;\u4ece\u786c\u4ef6\u89c4\u683c\u3001\u6a21\u5757\u4f9d\u8d56\u3001\u7f16\u8bd1\u5b89\u88c5\u5230\u89c4\u5219\u914d\u7f6e\u3001\u6027\u80fd\u8bc4\u4f30\u5168\u9762\u5c55\u5f00&#xff0c;\u5e2e\u52a9\u4f60\u6784\u5efa\u4e00\u4e2a\u53ef\u7528\u4e8e\u751f\u4ea7\u7684 NginxModSecurity WAF \u89e3\u51b3\u65b9\u6848\u3002<br \/>\n\u6211\u5728\u90e8\u7f72\u8fc7\u7a0b<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[117,103,43],"topic":[],"class_list":["post-63000","post","type-post","status-publish","format-standard","hentry","category-server","tag-nginx","tag-ubuntu","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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.wsisp.com\/helps\/63000.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5728\u5b9e\u9645\u8fd0\u7ef4\u548c\u67b6\u6784\u4f18\u5316\u4e2d&#xff0c;Web \u5e94\u7528\u9632\u706b\u5899&#xff08;WAF&#xff09;\u662f\u4fdd\u62a4 Web \u5e94\u7528\u514d\u53d7\u5e38\u89c1\u653b\u51fb&#xff08;\u5982 SQL \u6ce8\u5165\u3001XSS\u3001\u6587\u4ef6\u5305\u542b\u7b49&#xff09;\u7684\u91cd\u8981\u7ec4\u4ef6\u3002A5\u6570\u636e\u672c\u6559\u7a0b\u57fa\u4e8e Ubuntu 22.04 LTS&#xff0c;\u5728\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u73af\u5883\u4e0b&#xff0c;\u4ece\u786c\u4ef6\u89c4\u683c\u3001\u6a21\u5757\u4f9d\u8d56\u3001\u7f16\u8bd1\u5b89\u88c5\u5230\u89c4\u5219\u914d\u7f6e\u3001\u6027\u80fd\u8bc4\u4f30\u5168\u9762\u5c55\u5f00&#xff0c;\u5e2e\u52a9\u4f60\u6784\u5efa\u4e00\u4e2a\u53ef\u7528\u4e8e\u751f\u4ea7\u7684 NginxModSecurity WAF \u89e3\u51b3\u65b9\u6848\u3002 \u6211\u5728\u90e8\u7f72\u8fc7\u7a0b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/63000.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-20T21:26:00+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63000.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/63000.html\",\"name\":\"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-20T21:26:00+00:00\",\"dateModified\":\"2026-01-20T21:26:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/63000.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/63000.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63000.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/63000.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5728\u5b9e\u9645\u8fd0\u7ef4\u548c\u67b6\u6784\u4f18\u5316\u4e2d&#xff0c;Web \u5e94\u7528\u9632\u706b\u5899&#xff08;WAF&#xff09;\u662f\u4fdd\u62a4 Web \u5e94\u7528\u514d\u53d7\u5e38\u89c1\u653b\u51fb&#xff08;\u5982 SQL \u6ce8\u5165\u3001XSS\u3001\u6587\u4ef6\u5305\u542b\u7b49&#xff09;\u7684\u91cd\u8981\u7ec4\u4ef6\u3002A5\u6570\u636e\u672c\u6559\u7a0b\u57fa\u4e8e Ubuntu 22.04 LTS&#xff0c;\u5728\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u73af\u5883\u4e0b&#xff0c;\u4ece\u786c\u4ef6\u89c4\u683c\u3001\u6a21\u5757\u4f9d\u8d56\u3001\u7f16\u8bd1\u5b89\u88c5\u5230\u89c4\u5219\u914d\u7f6e\u3001\u6027\u80fd\u8bc4\u4f30\u5168\u9762\u5c55\u5f00&#xff0c;\u5e2e\u52a9\u4f60\u6784\u5efa\u4e00\u4e2a\u53ef\u7528\u4e8e\u751f\u4ea7\u7684 NginxModSecurity WAF \u89e3\u51b3\u65b9\u6848\u3002 \u6211\u5728\u90e8\u7f72\u8fc7\u7a0b","og_url":"https:\/\/www.wsisp.com\/helps\/63000.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-20T21:26:00+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/63000.html","url":"https:\/\/www.wsisp.com\/helps\/63000.html","name":"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-20T21:26:00+00:00","dateModified":"2026-01-20T21:26:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/63000.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/63000.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/63000.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u5728 Ubuntu 22.04 \u7cfb\u7edf\u7684\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u90e8\u7f72 Nginx+ModSecurity WAF \u5b9e\u73b0 Web \u5e94\u7528\u9632\u706b\u5899\u9632\u62a4\u6d41\u7a0b\u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/63000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=63000"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/63000\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=63000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=63000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=63000"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=63000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}