{"id":1131,"date":"2026-06-15T07:11:51","date_gmt":"2026-06-14T23:11:51","guid":{"rendered":"https:\/\/www.loongdi.net\/blog\/?p=1131"},"modified":"2026-06-15T07:11:51","modified_gmt":"2026-06-14T23:11:51","slug":"%e6%9c%80%e5%a5%bd%e7%9a%84%e6%a3%8b%e7%89%8c%e9%ab%98%e9%98%b2%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/www.loongdi.net\/blog\/1131.html","title":{"rendered":"\u6700\u597d\u7684\u68cb\u724c\u9ad8\u9632\u670d\u52a1\u5668\u65b9\u6848"},"content":{"rendered":"<p><p>\u5728\u4e92\u8054\u7f51\u9ad8\u901f\u53d1\u5c55\u7684\u4eca\u5929\uff0c\u68cb\u724c\u6e38\u620f\u6210\u4e3a\u4e86\u4f17\u591a\u73a9\u5bb6\u559c\u7231\u7684\u5a31\u4e50\u65b9\u5f0f\u3002\u7136\u800c\uff0c\u968f\u7740\u5728\u7ebf\u68cb\u724c\u6e38\u620f\u7684\u65e5\u76ca\u666e\u53ca\uff0c\u670d\u52a1\u5668\u9762\u4e34\u7740\u6765\u81ea\u5404\u79cd\u7f51\u7edc\u653b\u51fb\u7684\u5a01\u80c1\uff0c\u5982DDoS\u653b\u51fb\u7b49\u3002\u4e3a\u4e86\u786e\u4fdd\u68cb\u724c\u6e38\u620f\u670d\u52a1\u5668\u7684\u7a33\u5b9a\u8fd0\u884c\uff0c\u6211\u4eec\u9700\u8981\u642d\u5efa\u4e00\u4e2a\u9ad8\u9632\u670d\u52a1\u5668\u6765\u62b5\u5fa1\u8fd9\u4e9b\u653b\u51fb\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u6307\u5bfc\u60a8\u5982\u4f55\u642d\u5efa\u4e00\u4e2a\u68cb\u724c\u9ad8\u9632\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u524d\u7684\u51c6\u5907<\/h2>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u642d\u5efa\u9ad8\u9632\u670d\u52a1\u5668\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u51c6\u5907\u4ee5\u4e0b\u6761\u4ef6\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4e00\u53f0\u914d\u7f6e\u8f83\u9ad8\u7684\u670d\u52a1\u5668\u6216VPS<\/li>\n<li>\u64cd\u4f5c\u7cfb\u7edf\uff08\u5982Linux\u6216Windows Server\uff09<\/li>\n<li>\u57df\u540d\u89e3\u6790\uff08\u7528\u4e8e\u8bbf\u95ee\u670d\u52a1\u5668\uff09<\/li>\n<li>SSH\u5ba2\u6237\u7aef\uff08\u7528\u4e8e\u8fdc\u7a0b\u8fde\u63a5\u670d\u52a1\u5668\uff09<\/li>\n<\/ul>\n<p><h2>\u642d\u5efa\u68cb\u724c\u9ad8\u9632\u670d\u52a1\u5668\u6b65\u9aa4<\/h2>\n<\/p>\n<p><h3>1. \u5b89\u88c5\u670d\u52a1\u5668\u8f6f\u4ef6<\/h3>\n<\/p>\n<p><p>\u4ee5Linux\u670d\u52a1\u5668\u4e3a\u4f8b\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u670d\u52a1\u5668\u8f6f\u4ef6\u3002\u8fd9\u91cc\u4ee5Tomcat\u548cMySQL\u4e3a\u4f8b\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt-get update<\/p>\r\n<p>sudo apt-get install tomcat8<\/p>\r\n<p>sudo apt-get install mysql-server<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u914d\u7f6eMySQL\u6570\u636e\u5e93<\/h3>\n<\/p>\n<p><p>\u542f\u52a8MySQL\u670d\u52a1\uff0c\u5e76\u8bbe\u7f6eroot\u7528\u6237\u7684\u5bc6\u7801\u3002<\/p>\n<\/p>\n<p><pre><code>sudo systemctl start mysql<\/p>\r\n<p>sudo mysql_secure_installation<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3. \u5b89\u88c5\u9ad8\u9632\u8f6f\u4ef6<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u63d0\u9ad8\u670d\u52a1\u5668\u7684\u9632\u62a4\u80fd\u529b\uff0c\u6211\u4eec\u53ef\u4ee5\u5b89\u88c5\u4e00\u4e9b\u9ad8\u9632\u8f6f\u4ef6\uff0c\u5982fail2ban\u548cNginx\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt-get install fail2ban<\/p>\r\n<p>sudo apt-get install nginx<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>4. \u914d\u7f6eNginx\u53cd\u5411\u4ee3\u7406<\/h3>\n<\/p>\n<p><p>\u7f16\u8f91Nginx\u914d\u7f6e\u6587\u4ef6\uff0c\u8bbe\u7f6e\u53cd\u5411\u4ee3\u7406\u3002<\/p>\n<\/p>\n<p><pre><code>sudo nano \/etc\/nginx\/sites-available\/default<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code>server {<\/p>\r\n<p>    listen 80;<\/p>\r\n<p>    server_name yourdomain.com;<\/p>\r\n\r\n<p>    location \/ {<\/p>\r\n<p>        proxy_pass http:\/\/localhost:8080;<\/p>\r\n<p>        proxy_set_header Host $host;<\/p>\r\n<p>        proxy_set_header X-Real-IP $remote_addr;<\/p>\r\n<p>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\r\n<p>        proxy_set_header X-Forwarded-Proto $scheme;<\/p>\r\n<p>    }<\/p>\r\n<p>}<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>5. \u914d\u7f6efail2ban<\/h3>\n<\/p>\n<p><p>\u7f16\u8f91fail2ban\u914d\u7f6e\u6587\u4ef6\uff0c\u8bbe\u7f6e\u9632\u62a4\u89c4\u5219\u3002<\/p>\n<\/p>\n<p><pre><code>sudo nano \/etc\/fail2ban\/jail.conf<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<p><pre><code>[nginx-http]<\/p>\r\n<p>enabled = true<\/p>\r\n<p>port = http,https<\/p>\r\n<p>filter = nginx-http<\/p>\r\n<p>logpath = \/var\/log\/nginx\/access.log<\/p>\r\n<p>maxretry = 5<\/p>\r\n<p>findtime = 600<\/p>\r\n<p>bantime = 3600<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>6. \u91cd\u542f\u76f8\u5173\u670d\u52a1<\/h3>\n<\/p>\n<p><p>\u91cd\u542fNginx\u548cfail2ban\u670d\u52a1\uff0c\u4f7f\u914d\u7f6e\u751f\u6548\u3002<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.loongdi.net\/blog\/wp-content\/uploads\/2026\/03\/S30l2gHQ.jpg\" alt=\"\u6700\u597d\u7684\u68cb\u724c\u9ad8\u9632\u670d\u52a1\u5668\u65b9\u6848\" title=\"\u6700\u597d\u7684\u68cb\u724c\u9ad8\u9632\u670d\u52a1\u5668\u65b9\u6848\"><\/p>\n<\/p>\n<p><pre><code>sudo systemctl restart nginx<\/p>\r\n<p>sudo systemctl restart fail2ban<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u6ce8\u610f\u4e8b\u9879<\/h2>\n<\/p>\n<ul>\n<li>\u8bf7\u786e\u4fdd\u670d\u52a1\u5668\u9632\u706b\u5899\u5df2\u5173\u95ed\uff0c\u5426\u5219\u65e0\u6cd5\u8bbf\u95ee\u3002<\/li>\n<li>\u8bf7\u5c06\u670d\u52a1\u5668\u8f6f\u4ef6\u7684\u7aef\u53e3\u6620\u5c04\u5230\u516c\u7f51IP\u4e0a\u3002<\/li>\n<li>\u5b9a\u671f\u66f4\u65b0\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u4fdd\u6301\u7cfb\u7edf\u5b89\u5168\u3002<\/li>\n<\/ul>\n<p><h2>\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u642d\u5efa\u4e86\u4e00\u4e2a\u68cb\u724c\u9ad8\u9632\u670d\u52a1\u5668\u3002\u5728\u5b9e\u9645\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u6839\u636e\u9700\u6c42\u8c03\u6574\u76f8\u5173\u914d\u7f6e\uff0c\u4ee5\u63d0\u9ad8\u670d\u52a1\u5668\u7684\u6027\u80fd\u548c\u5b89\u5168\u6027\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4e92\u8054\u7f51\u9ad8\u901f\u53d1\u5c55\u7684\u4eca\u5929\uff0c\u68cb\u724c\u6e38\u620f\u6210\u4e3a\u4e86\u4f17\u591a\u73a9\u5bb6\u559c\u7231\u7684\u5a31\u4e50\u65b9\u5f0f\u3002\u7136\u800c\uff0c\u968f\u7740\u5728\u7ebf\u68cb\u724c\u6e38\u620f\u7684\u65e5\u76ca\u666e\u53ca\uff0c\u670d\u52a1\u5668\u9762\u4e34\u7740\u6765\u81ea\u5404\u79cd\u7f51\u7edc\u653b\u51fb\u7684\u5a01\u80c1\uff0c\u5982DDoS\u653b\u51fb\u7b49\u3002\u4e3a\u4e86\u786e\u4fdd\u68cb\u724c\u6e38\u620f\u670d\u52a1\u5668\u7684\u7a33\u5b9a\u8fd0\u884c\uff0c\u6211\u4eec\u9700\u8981\u642d\u5efa\u4e00\u4e2a\u9ad8\u9632\u670d\u52a1\u5668\u6765\u62b5\u5fa1\u8fd9\u4e9b\u653b\u51fb\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u6307\u5bfc&#8230;<\/p>\n","protected":false},"author":1,"featured_media":55,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-1131","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-yun"],"_links":{"self":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/1131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/comments?post=1131"}],"version-history":[{"count":1,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/1131\/revisions"}],"predecessor-version":[{"id":1132,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/1131\/revisions\/1132"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media\/55"}],"wp:attachment":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media?parent=1131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/categories?post=1131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/tags?post=1131"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/topic?post=1131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}