{"id":360,"date":"2020-08-24T03:32:40","date_gmt":"2020-08-23T19:32:40","guid":{"rendered":"http:\/\/log.tanxiaodian.com\/?p=360"},"modified":"2020-08-24T03:32:40","modified_gmt":"2020-08-23T19:32:40","slug":"linux%e8%ae%be%e7%bd%ae%e9%98%b2%e7%81%ab%e5%a2%99","status":"publish","type":"post","link":"https:\/\/log.tanxiaodian.com\/?p=360","title":{"rendered":"Linux\u8bbe\u7f6e\u9632\u706b\u5899"},"content":{"rendered":"<p>https:\/\/baijiahao.baidu.com\/s?id=1644737268013095059&#038;wfr=spider&#038;for=pc<\/p>\n<p><span class=\"bjh-p\">\u5c0f\u7f16\u53d1\u73b0\uff0c\u963f\u91cc\u4e91\u597d\u591a\u670d\u52a1\u5668\u4f7f\u7528\u7684\u90fd\u662fCentos 7\u7248\u672c\uff0c\u5f53\u6211\u4eec\u79df\u7528\u963f\u91cc\u4e91\u670d\u52a1\u5668\u65f6\uff0c\u8981\u8c28\u614e\u7684\u7ba1\u7406\u6211\u4eec\u670d\u52a1\u7684\u7aef\u53e3\uff0c\u4e5f\u5c31\u662f\u5b89\u5168\u7ec4\u7b56\u7565\uff0c\u5426\u5219\u6211\u4eec\u7684\u5e94\u7528\u5f88\u5bb9\u6613\u906d\u53d7\u653b\u51fb\uff0c\u6240\u4ee5\u6211\u4eec\u6709\u5fc5\u8981\u4e86\u89e3\u4e00\u4e0bcentos7\u7684\u9632\u706b\u5899\u77e5\u8bc6\uff0c\u5f53\u4f60\u79df\u7528\u963f\u91cc\u4e91\u670d\u52a1\u5668\u540e\u5c31\u53ef\u81ea\u884c\u7ba1\u7406\u670d\u52a1\u5668\u7aef\u53e3\u4e86\u3002<\/span><\/p>\n<p><span class=\"bjh-p\">firewall\u9632\u706b\u5899\u7684\u4f7f\u7528<\/span><\/p>\n<p><span class=\"bjh-p\">\u9632\u706b\u5899\uff0c\u4e3b\u8981\u7528\u6237\u4fe1\u606f\u5b89\u5168\u9632\u62a4\uff0c\u4e3b\u8981\u6709\u8f6f\u4ef6\u9632\u706b\u5899\u548c\u786c\u4ef6\u9632\u706b\u5899\u3002firewalld\u9632\u706b\u5899\u662f\u8f6f\u4ef6\u9632\u706b\u5899\uff0c\u5728centos7 \u4e4b\u524d\u9ed8\u8ba4\u91c7\u7528\u7684\u9632\u706b\u5899\u662fiptables\uff0c\u800c\u5728centos 7\u5219\u662f\u91c7\u7528firewall\uff0cfirewall\u9632\u706b\u5899\u662fiptables\u7684\u5347\u7ea7\u7248\uff0c\u5728\u5b89\u5168\u6027\u80fd\u7b49\u5404\u65b9\u9762\u90fd\u6709\u663e\u8457\u7684\u63d0\u9ad8\uff0c\u800c\u4e14\u64cd\u4f5c\u8d77\u6765\u4e5f\u65b9\u4fbf\u8bb8\u591a\u3002<\/span><\/p>\n<p><span class=\"bjh-p\">\u9996\u5148\uff0c\u6211\u4eec\u901a\u8fc7systemctl status firewalld\u547d\u4ee4\u67e5\u770b\u9632\u706b\u5899\u7684\u670d\u52a1\u72b6\u6001\uff0c<\/span><\/p>\n<div class=\"img-container\"><\/div>\n<p><span class=\"bjh-p\">\u53ef\u4ee5\u770b\u5230\uff0c\u5c0f\u7f16\u7684centos7\u9632\u706b\u5899\u670d\u52a1\u72b6\u6001\u662f\u8fd0\u884c\u72b6\u6001\uff0c\u5982\u4f55\u5f00\u542f\u3001\u5173\u95ed\u3001\u91cd\u542f\u670d\u52a1\u5462\u5462\uff1f<\/span><\/p>\n<p><span class=\"bjh-p\">1\uff09\u5f00\u542f\uff1asystemctl start firewalld.service2\uff09\u5173\u95ed\uff1asystemctl stop firewalld.service3\uff09\u91cd\u542f\uff1asystemctl restart firewalld.service<\/span><\/p>\n<p><span class=\"bjh-p\">\u5de5\u4f5c\u4e2d\uff0c\u67e5\u770b\u9632\u706b\u5899\u7684\u72b6\u6001\u4f7f\u7528firewall-cmd &#8211;state\u8fd9\u6761\u547d\u4ee4\uff0c\u90a3\u9632\u706b\u5899\u72b6\u6001\u548c\u670d\u52a1\u4e4b\u95f4\u4ec0\u4e48\u5173\u7cfb\uff0c\u53ef\u7406\u89e3\u4e3a\u9632\u706b\u5899\u72b6\u6001\u662f\u9632\u706b\u5899\u670d\u52a1\u7684\u5176\u4e2d\u4e4b\u4e00\u7684\u529f\u80fd\u3002<\/span><\/p>\n<div class=\"img-container\"><\/div>\n<p><span class=\"bjh-p\">\u5047\u5982\u6211\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4e86nginx\uff0c\u4e14\u4f7f\u7528\u4e8680\u7aef\u53e3\uff0c\u5982\u4f55\u67e5\u770b\u8be5\u7aef\u53e3\u7684\u4f7f\u7528\u60c5\u51b5\u5462\uff0c\u4f7f\u7528firewall-cmd &#8211;query-port=80\/tcp \u547d\u4ee4\u5373\u53ef<\/span><\/p>\n<div class=\"img-container\"><\/div>\n<p><span class=\"bjh-p\">\u53ef\u89c1\uff0c\u5c0f\u7f16\u7684\u670d\u52a1\u5668\u662f\u6ca1\u6709\u5f00\u542f80\u7aef\u53e3\u7684\uff0c\u5f00\u653e\u7aef\u53e3\u7684\u547d\u4ee4\u4e5f\u5f88\u7b80\u5355\uff1afirewall-cmd &#8211;permanent &#8211;add-port=80\/tcp \uff08&#8211;permanent\u6c38\u4e45\u751f\u6548\uff0c\u6ca1\u6709\u6b64\u53c2\u6570\u91cd\u542f\u540e\u5c31\u5931\u6548\uff09\uff0c\u6ce8\u610f\u8bbe\u7f6e\u597d\u540e\u9700\u8981\u91cd\u542f\u4e00\u4e0b\u9632\u706b\u5899\u670d\u52a1\uff0c\u6216\u8005\u4f7f\u7528firewall-cmd &#8211;reload\u547d\u4ee4\u52a0\u8f7d\u751f\u6548\u5f00\u653e\u7684\u7aef\u53e3\u3002<\/span><\/p>\n<p><span class=\"bjh-p\">\u4e0a\u8ff0\u53ea\u662f\u9488\u5bf980\u7aef\u53e3\uff0c\u5982\u679c\u8981\u67e5\u770b\u670d\u52a1\u5668\u6240\u6709\u7aef\u53e3\u7684\u5f00\u542f\u60c5\u51b5\uff0c\u4f7f\u7528firewall-cmd &#8211;list-port\u547d\u4ee4\u3002<\/span><\/p>\n<p><span class=\"bjh-p\">\u5f53\u7136\uff0c\u6709\u5f00\u542f\u5c31\u6709\u5173\u95ed\uff0cfirewall-cmd &#8211;remove-port=80\/tcp\u547d\u4ee4\u53ef\u4ee5\u5173\u95ed\u6211\u4eec\u7684\u7aef\u53e3\u3002<\/span><\/p>\n<p><span class=\"bjh-p\">\u57fa\u672c\u4e0a\u4e0a\u8ff0\u77e5\u8bc6\u5c31\u53ef\u4ee5\u81ea\u7531\u7ba1\u7406\u6211\u4eec\u7684\u670d\u52a1\u72b6\u6001\u4e86\uff0c\u6700\u540e\u7ed9\u5927\u5bb6\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0bSELinux\uff0cSELinux \u6bd4\u8f83\u590d\u6742\uff0c\u662fLinux\u7684\u5185\u6838\u6a21\u5757\uff0c\u662fLinux\u7684\u5b89\u5168\u5b50\u7cfb\u7edf\uff0c\u5b83\u7684\u4f5c\u7528\u5c31\u662f\u6700\u5927\u9650\u5ea6\u5730\u51cf\u5c11\u7cfb\u7edf\u670d\u52a1\u8fdb\u7a0b\u7684\u8bbf\u95ee\u8d44\u6e90\uff0c\u5b83\u6709\u4e09\u79cd\u5de5\u4f5c\u6a21\u5f0f\uff1a<\/span><\/p>\n<p><span class=\"bjh-p\"><span class=\"bjh-strong\">enforcing\u00a0<\/span>\uff1a\u5f3a\u5236\u6a21\u5f0f\u3002\u8fdd\u53cdSELinux\u89c4\u5219\u7684\u884c\u4e3a\u5c06\u4f1a\u88ab\u963b\u6b62\u5e76\u8bb0\u5f55\u5230\u65e5\u5fd7\u4e2d\u53bb<span class=\"bjh-strong\">permissive<\/span>\uff1a\u5bbd\u5bb9\u6a21\u5f0f\u3002\u8fdd\u53cdSELinux\u89c4\u5219\u7684\u884c\u4e3a\u5c06\u4f1a\u8bb0\u5f55\u5230\u65e5\u5fd7\u4e2d\u53bb<span class=\"bjh-strong\">disabled<\/span>\uff1a\u5173\u95ed\u6a21\u5f0f\u3002<\/span><\/p>\n<p><span class=\"bjh-p\">SELinux\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\uff1a\/etc\/selinux\/config<\/span><\/p>\n<div class=\"img-container\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/baijiahao.baidu.c&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/log.tanxiaodian.com\/?p=360\">Continue reading<span class=\"screen-reader-text\">Linux\u8bbe\u7f6e\u9632\u706b\u5899<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/360"}],"collection":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360"}],"version-history":[{"count":1,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions\/361"}],"wp:attachment":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}