{"id":711,"date":"2026-01-28T02:57:17","date_gmt":"2026-01-28T02:57:17","guid":{"rendered":"https:\/\/blog.gpst.net.cn:4008\/?p=711"},"modified":"2026-02-05T08:49:13","modified_gmt":"2026-02-05T08:49:13","slug":"%e5%9f%ba%e4%ba%8enginx%e6%a0%87%e5%87%86%e9%95%9c%e5%83%8f%e6%9e%84%e5%bb%bamodsecurity%e6%94%af%e6%8c%81","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=711","title":{"rendered":"\u57fa\u4e8enginx\u6807\u51c6\u955c\u50cf\u6784\u5efaModSecurity+Brotli\u6a21\u5757\u652f\u6301"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>FROM nginx:1.27.5\nRUN \/bin\/rm -f \/etc\/apt\/sources.list.d\/debian.sources &amp;&amp; \\\n    echo \"deb http:\/\/mirrors.nju.edu.cn\/debian\/ bookworm main contrib non-free non-free-firmware\" &gt;\/etc\/apt\/sources.list &amp;&amp; \\\n    echo \"deb http:\/\/mirrors.nju.edu.cn\/debian\/ bookworm-updates main contrib non-free non-free-firmware\" &gt;&gt;\/etc\/apt\/sources.list &amp;&amp; \\\n    echo \"deb http:\/\/mirrors.nju.edu.cn\/debian-security bookworm-security\/updates main contrib non-free non-free-firmware\" &gt;&gt;\/etc\/apt\/sources.list &amp;&amp; \\\n    apt-get update &amp;&amp; apt-get install -y --no-install-recommends \\\n    gcc \\\n    g++ \\\n    make \\\n    libpcre3 \\\n    libpcre3-dev \\\n    libssl-dev \\\n    libxml2 \\\n    libxml2-dev \\\n    libcurl4-openssl-dev \\\n    libgeoip-dev \\\n    libyajl-dev \\\n    libbrotli-dev \\\n    pkg-config \\\n    zlib1g-dev \\\n    automake \\\n    autoconf \\\n    libtool &amp;&amp; \\\n    rm -rf \/var\/lib\/apt\/lists\/*\nWORKDIR \/app\nADD .\/modsecurity-v3.0.13.tar.gz \/app\nRUN cd modsecurity-v3.0.13 &amp;&amp; \\\n    .\/build.sh &amp;&amp; \\\n    .\/configure --prefix=\/app\/modsecurity &amp;&amp; \\\n    make &amp;&amp; \\\n    make install &amp;&amp; \\\n    cd .. &amp;&amp; \\\n    rm -rf modsecurity-v3.0.13\nADD .\/ModSecurity-nginx-v1.0.4.tar.gz \/app\nADD .\/ngx_brotli.tar.gz \/app\nADD .\/nginx-1.27.5.tar.gz \/app\nRUN cd nginx-1.27.5 &amp;&amp; \\\n    ln -svf \/app\/modsecurity \/usr\/local &amp;&amp; \\\n    .\/configure --with-compat --add-dynamic-module=..\/ModSecurity-nginx-v1.0.4 --add-dynamic-module=..\/ngx_brotli &amp;&amp; \\\n    make modules &amp;&amp; \\\n    cp objs\/ngx_http_modsecurity_module.so \/usr\/lib\/nginx\/modules\/ngx_http_modsecurity_module.so &amp;&amp; \\\n    cp objs\/ngx_http_brotli_filter_module.so objs\/ngx_http_brotli_static_module.so \/usr\/lib\/nginx\/modules\/ &amp;&amp; \\\n    sed -i '\/events {\/iload_module modules\/ngx_http_modsecurity_module.so;\\nload_module modules\/ngx_http_brotli_filter_module.so;\\nload_module modules\/ngx_http_brotli_static_module.so;\\n' \/etc\/nginx\/nginx.conf &amp;&amp; \\\n    cd .. &amp;&amp; \\\n    rm -rf nginx-1.27.5\n<\/code><\/pre>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-41426dbc-1e15-4fde-bc3e-61b51f93cb56\" href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/coreruleset-4.22.0.tar.gz\">coreruleset-4.22.0.tar<\/a><a href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/coreruleset-4.22.0.tar.gz\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-41426dbc-1e15-4fde-bc3e-61b51f93cb56\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-e185dc6a-4065-4d7d-b49e-ec2484a00467\" href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/ModSecurity-nginx-v1.0.4.tar.gz\">ModSecurity-nginx-v1.0.4.tar<\/a><a href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/ModSecurity-nginx-v1.0.4.tar.gz\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-e185dc6a-4065-4d7d-b49e-ec2484a00467\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-9917c6a5-9847-4e67-b695-27aa03130fc7\" href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/modsecurity-v3.0.13.tar.gz\">modsecurity-v3.0.13.tar<\/a><a href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/modsecurity-v3.0.13.tar.gz\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-9917c6a5-9847-4e67-b695-27aa03130fc7\">Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-8a150753-de2c-48a7-b77c-5750bd0807c7\" href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/nginx-1.27.5.tar.gz\">nginx-1.27.5.tar<\/a><a href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/01\/nginx-1.27.5.tar.gz\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-8a150753-de2c-48a7-b77c-5750bd0807c7\">Download<\/a><\/div>\n\n\n\n<p><a href=\"https:\/\/opshub.com.cn\/wp-content\/uploads\/2026\/02\/ngx_brotli.tar.gz\">ngx_brotli.tar.gz<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ngx_brotli.tar.gz<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-711","post","type-post","status-publish","format-standard","hentry","category-dockerkubernetes"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=711"}],"version-history":[{"count":9,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions"}],"predecessor-version":[{"id":815,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions\/815"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}