{"id":43314,"date":"2024-10-05T01:47:41","date_gmt":"2024-10-04T17:47:41","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43314\/"},"modified":"2024-10-05T01:47:41","modified_gmt":"2024-10-04T17:47:41","slug":"centos-7-%e4%b8%8b%e6%90%ad%e5%bb%ba%e7%99%be%e8%90%ac-pv-%e7%b6%b2%e7%ab%99%e6%9e%b6%e6%a7%8b%e8%a9%b3%e8%bf%b0","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43314\/","title":{"rendered":"CentOS 7 \u4e0b\u642d\u5efa\u767e\u842c PV \u7db2\u7ad9\u67b6\u69cb\u8a73\u8ff0"},"content":{"rendered":"<h1 id=\"centos-7-%e4%b8%8b%e6%90%ad%e5%bb%ba%e7%99%be%e8%90%ac-pv-%e7%b6%b2%e7%ab%99%e6%9e%b6%e6%a7%8b%e8%a9%b3%e8%bf%b0-RNZdwCFluy\">CentOS 7 \u4e0b\u642d\u5efa\u767e\u842c PV \u7db2\u7ad9\u67b6\u69cb\u8a73\u8ff0<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0c\u7db2\u7ad9\u7684\u6d41\u91cf\u548c\u6027\u80fd\u662f\u6210\u529f\u7684\u95dc\u9375\u56e0\u7d20\u4e4b\u4e00\u3002\u5c0d\u65bc\u4e00\u500b\u5e0c\u671b\u9054\u5230\u767e\u842c PV\uff08\u9801\u9762\u700f\u89bd\u91cf\uff09\u7684\u5927\u578b\u7db2\u7ad9\u4f86\u8aaa\uff0c\u9078\u64c7\u5408\u9069\u7684\u4f3a\u670d\u5668\u67b6\u69cb\u81f3\u95dc\u91cd\u8981\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7 \u4e0a\u642d\u5efa\u4e00\u500b\u9ad8\u6548\u7684\u7db2\u7ad9\u67b6\u69cb\uff0c\u4ee5\u652f\u6301\u9ad8\u6d41\u91cf\u7684\u9700\u6c42\u3002<\/p>\n<h2 id=\"1-%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99-RNZdwCFluy\">1. \u74b0\u5883\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u642d\u5efa\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u6e96\u5099\u597d\u4f3a\u670d\u5668\u74b0\u5883\u3002CentOS 7 \u662f\u4e00\u500b\u7a69\u5b9a\u4e14\u5ee3\u6cdb\u4f7f\u7528\u7684 Linux \u767c\u884c\u7248\uff0c\u9069\u5408\u7528\u65bc\u4f3a\u670d\u5668\u3002\u4ee5\u4e0b\u662f\u57fa\u672c\u7684\u74b0\u5883\u6e96\u5099\u6b65\u9a5f\uff1a<\/p>\n<ul>\n<li>\u9078\u64c7\u5408\u9069\u7684 VPS \u65b9\u6848\uff0c\u78ba\u4fdd\u6709\u8db3\u5920\u7684 CPU\u3001\u5167\u5b58\u548c\u5b58\u5132\u7a7a\u9593\u3002<\/li>\n<li>\u5b89\u88dd CentOS 7 \u64cd\u4f5c\u7cfb\u7d71\u3002<\/li>\n<li>\u66f4\u65b0\u7cfb\u7d71\u81f3\u6700\u65b0\u7248\u672c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ul>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<h2 id=\"2-%e5%ae%89%e8%a3%9d%e5%bf%85%e8%a6%81%e7%9a%84%e8%bb%9f%e4%bb%b6-RNZdwCFluy\">2. \u5b89\u88dd\u5fc5\u8981\u7684\u8edf\u4ef6<\/h2>\n<p>\u70ba\u4e86\u652f\u6301\u9ad8\u6d41\u91cf\u7db2\u7ad9\uff0c\u6211\u5011\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u8edf\u4ef6\uff0c\u5305\u62ec\u7db2\u9801\u4f3a\u670d\u5668\u3001\u6578\u64da\u5eab\u548c PHP\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"2-1-%e5%ae%89%e8%a3%9d-apache-RNZdwCFluy\">2.1 \u5b89\u88dd Apache<\/h3>\n<p>Apache \u662f\u4e00\u500b\u6d41\u884c\u7684\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u80fd\u5920\u8655\u7406\u5927\u91cf\u7684\u8acb\u6c42\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd Apache\uff1a<\/p>\n<pre><code>sudo yum install httpd -y<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 Apache \u4e26\u8a2d\u7f6e\u958b\u6a5f\u81ea\u555f\uff1a<\/p>\n<pre><code>sudo systemctl start httpd\nsudo systemctl enable httpd<\/code><\/pre>\n<h3 id=\"2-2-%e5%ae%89%e8%a3%9d-mysql-RNZdwCFluy\">2.2 \u5b89\u88dd MySQL<\/h3>\n<p>MySQL \u662f\u4e00\u500b\u6d41\u884c\u7684\u95dc\u4fc2\u578b\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u9069\u5408\u7528\u65bc\u5b58\u5132\u7db2\u7ad9\u6578\u64da\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd MySQL\uff1a<\/p>\n<pre><code>sudo yum install mariadb-server -y<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 MySQL \u4e26\u8a2d\u7f6e\u958b\u6a5f\u81ea\u555f\uff1a<\/p>\n<pre><code>sudo systemctl start mariadb\nsudo systemctl enable mariadb<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u57f7\u884c\u5b89\u5168\u6027\u914d\u7f6e\uff1a<\/p>\n<pre><code>sudo mysql_secure_installation<\/code><\/pre>\n<h3 id=\"2-3-%e5%ae%89%e8%a3%9d-php-RNZdwCFluy\">2.3 \u5b89\u88dd PHP<\/h3>\n<p>PHP \u662f\u4e00\u7a2e\u5ee3\u6cdb\u4f7f\u7528\u7684\u4f3a\u670d\u5668\u7aef\u8173\u672c\u8a9e\u8a00\uff0c\u9069\u5408\u7528\u65bc\u52d5\u614b\u7db2\u7ad9\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd PHP \u53ca\u5176\u5e38\u7528\u64f4\u5c55\uff1a<\/p>\n<pre><code>sudo yum install php php-mysql php-gd php-xml -y<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u91cd\u555f Apache \u4ee5\u52a0\u8f09 PHP \u6a21\u7d44\uff1a<\/p>\n<pre><code>sudo systemctl restart httpd<\/code><\/pre>\n<h2 id=\"3-%e5%84%aa%e5%8c%96%e4%bc%ba%e6%9c%8d%e5%99%a8%e6%80%a7%e8%83%bd-RNZdwCFluy\">3. \u512a\u5316\u4f3a\u670d\u5668\u6027\u80fd<\/h2>\n<p>\u70ba\u4e86\u652f\u6301\u767e\u842c PV \u7684\u9700\u6c42\uff0c\u4f3a\u670d\u5668\u6027\u80fd\u512a\u5316\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u512a\u5316\u5efa\u8b70\uff1a<\/p>\n<ul>\n<li><strong>\u555f\u7528\u7de9\u5b58\uff1a<\/strong>\u4f7f\u7528 Apache \u7684 mod_cache \u6a21\u7d44\u6216 Varnish \u4f86\u7de9\u5b58\u975c\u614b\u5167\u5bb9\uff0c\u6e1b\u5c11\u4f3a\u670d\u5668\u8ca0\u64d4\u3002<\/li>\n<li><strong>\u4f7f\u7528 CDN\uff1a<\/strong>\u5c07\u975c\u614b\u8cc7\u6e90\uff08\u5982\u5716\u7247\u3001CSS \u548c JavaScript\uff09\u653e\u5728\u5167\u5bb9\u5206\u767c\u7db2\u7d61\uff08CDN\uff09\u4e0a\uff0c\u4ee5\u63d0\u9ad8\u52a0\u8f09\u901f\u5ea6\u3002<\/li>\n<li><strong>\u6578\u64da\u5eab\u512a\u5316\uff1a<\/strong>\u5b9a\u671f\u6e05\u7406\u6578\u64da\u5eab\uff0c\u4f7f\u7528\u7d22\u5f15\u4f86\u52a0\u901f\u67e5\u8a62\u3002<\/li>\n<li><strong>\u76e3\u63a7\u4f3a\u670d\u5668\u6027\u80fd\uff1a<\/strong>\u4f7f\u7528\u5de5\u5177\u5982 Nagios \u6216 Zabbix \u4f86\u76e3\u63a7\u4f3a\u670d\u5668\u7684\u6027\u80fd\u548c\u6d41\u91cf\u3002<\/li>\n<\/ul>\n<h2 id=\"4-%e5%ae%89%e5%85%a8%e6%80%a7%e8%80%83%e9%87%8f-RNZdwCFluy\">4. \u5b89\u5168\u6027\u8003\u91cf<\/h2>\n<p>\u9ad8\u6d41\u91cf\u7db2\u7ad9\u7684\u5b89\u5168\u6027\u540c\u6a23\u91cd\u8981\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5b89\u5168\u6027\u5efa\u8b70\uff1a<\/p>\n<ul>\n<li>\u5b9a\u671f\u66f4\u65b0\u7cfb\u7d71\u548c\u8edf\u4ef6\uff0c\u4fee\u88dc\u5df2\u77e5\u6f0f\u6d1e\u3002<\/li>\n<li>\u4f7f\u7528\u9632\u706b\u7246\uff08\u5982 firewalld\uff09\u4f86\u9650\u5236\u4e0d\u5fc5\u8981\u7684\u8a2a\u554f\u3002<\/li>\n<li>\u5b9a\u671f\u5099\u4efd\u6578\u64da\uff0c\u4ee5\u9632\u6578\u64da\u4e1f\u5931\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-RNZdwCFluy\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS 7 \u4e0a\u642d\u5efa\u4e00\u500b\u652f\u6301\u767e\u842c PV \u7684\u7db2\u7ad9\u67b6\u69cb\u9700\u8981\u4ed4\u7d30\u7684\u898f\u5283\u548c\u5be6\u65bd\u3002\u901a\u904e\u9078\u64c7\u5408\u9069\u7684\u4f3a\u670d\u5668\u74b0\u5883\u3001\u5b89\u88dd\u5fc5\u8981\u7684\u8edf\u4ef6\u3001\u512a\u5316\u6027\u80fd\u4ee5\u53ca\u52a0\u5f37\u5b89\u5168\u6027\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u61c9\u5c0d\u9ad8\u6d41\u91cf\u7684\u6311\u6230\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u53ef\u9760\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\u4ee5\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8a73\u7d30\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7 \u4e0a\u642d\u5efa\u9ad8\u6d41\u91cf\u7db2\u7ad9\u67b6\u69cb\uff0c\u5be6\u73fe\u767e\u842c PV \u7684\u6027\u80fd\u512a\u5316\u8207\u7a69\u5b9a\u6027\u63d0\u5347\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-43314","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=43314"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43314\/revisions"}],"predecessor-version":[{"id":43315,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43314\/revisions\/43315"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}