{"id":24,"date":"2025-05-20T23:58:09","date_gmt":"2025-05-20T15:58:09","guid":{"rendered":"https:\/\/itfinn.com\/?p=24"},"modified":"2025-05-20T23:58:09","modified_gmt":"2025-05-20T15:58:09","slug":"centos-7-%e6%89%93%e5%bc%80%e5%85%b3%e9%97%ad%e7%ab%af%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/itfinn.com\/index.php\/2025\/05\/20\/centos-7-%e6%89%93%e5%bc%80%e5%85%b3%e9%97%ad%e7%ab%af%e5%8f%a3\/","title":{"rendered":"CentOS 7 \u6253\u5f00&amp;\u5173\u95ed\u7aef\u53e3"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">1. \u9632\u706b\u5899\u7684\u64cd\u4f5c<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>CentOS 7\u4f7f\u7528\u7684\u662ffirewall\u9632\u706b\u5899\uff0c\u4e0d\u518d\u662f\u539f\u6765\u7684iptables\u3002<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code># \u67e5\u770bfirewall\u9632\u706b\u5899\u72b6\u6001\nfirewall-cmd --state\nsystemctl status firewalld\n\n# \u6253\u5f00\u9632\u706b\u5899  \nsystemctl start firewalld\n\n# \u5173\u95ed\u9632\u706b\u5899  \nsystemctl stop firewalld\n\n# \u91cd\u542f\u9632\u706b\u5899  \nfirewall-cmd --reload\nsystemctl reload firewalld\n\n# \u5f00\u673a\u81ea\u542f\u52a8\u9632\u706b\u5899  \nsystemctl enable firewalld\n\n# \u7981\u6b62\u5f00\u673a\u542f\u52a8\u9632\u706b\u5899  \nsystemctl disable firewalld\n\n# \u67e5\u770b\u5df2\u6253\u5f00\u7684\u7aef\u53e3  \nfirewall-cmd --list-ports\n\n# \u6253\u5f00\u7aef\u53e3  \n# \u547d\u4ee4\u542b\u4e49\uff1a\n\u2013zone #\u4f5c\u7528\u57df\n\u2013add-port=80\/tcp #\u6dfb\u52a0\u7aef\u53e3\uff0c\u683c\u5f0f\u4e3a\uff1a\u7aef\u53e3\/\u901a\u8baf\u534f\u8bae\n\u2013permanent #\u6c38\u4e45\u751f\u6548\uff0c\u6ca1\u6709\u6b64\u53c2\u6570\u91cd\u542f\u540e\u5931\u6548\n\nfirewall-cmd --permanent --zone=public --add-port=8080\/tcp\n\n# \u5173\u95ed\u7aef\u53e3  \n\nfirewall-cmd --permanent --zone=public --remove-port=8080\/tcp<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u7aef\u53e3\u64cd\u4f5c<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># \u6839\u636e\u7aef\u53e3\u53f7\u5f97\u5230\u5176\u5360\u7528\u7684\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\nnetstat -tlnp | grep 80\n\n# \u4e00\u6b21\u6027\u7684\u6e05\u9664\u5360\u752880\u7aef\u53e3\u7684\u7a0b\u5e8f\nlsof -i :80|grep -v \"PID\"|awk '{print \"kill -9\",$2}'|sh\n\n# \u624b\u5de5\u7ec8\u6b62\u8fdb\u7a0b\u7684\u8fd0\u884c\nkill 5014\n# \u5982\u679c\u7ec8\u6b62\u4e0d\u4e86\uff0c\u53ef\u4ee5\u5f3a\u5236\u7ec8\u6b62\nkill -9 5014<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. \u9632\u706b\u5899\u7684\u64cd\u4f5c CentOS 7\u4f7f\u7528\u7684\u662ffirewall\u9632\u706b\u5899\uff0c\u4e0d\u518d\u662f\u539f\u6765\u7684iptables\u3002 2. \u7aef\u53e3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-development"],"_links":{"self":[{"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":1,"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":25,"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/posts\/24\/revisions\/25"}],"wp:attachment":[{"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itfinn.com\/index.php\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}