{"id":63643,"date":"2025-04-29T15:44:11","date_gmt":"2025-04-29T07:44:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63643\/"},"modified":"2025-04-29T15:44:11","modified_gmt":"2025-04-29T07:44:11","slug":"apache%e6%80%8e%e4%b9%88%e5%88%a0%e9%99%a4%e5%a4%9a%e4%bd%99%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%90%8d-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63643\/","title":{"rendered":"apache\u600e\u4e48\u5220\u9664\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d"},"content":{"rendered":"<blockquote><p>\n  \u8981\u5220\u9664 apache \u4e2d\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d\uff0c\u8bf7\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\u5e76\u5220\u9664 servername \u6307\u4ee4\uff1a\u5b9a\u4f4d\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4e3a \/etc\/apache2\/httpd.conf \u6216 \/etc\/apache2\/apache2.conf\uff09\u3002\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u5e76\u5220\u9664\u4e0d\u9700\u8981\u7684 servername \u6307\u4ee4\u3002\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u542f apache\uff1aubuntu\/debian\uff1asudo systemctl restart apache2\uff1bcentos\/red hat\uff1asudo systemctl restart httpd\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/03\/2024060318573985912.jpg\" class=\"aligncenter\" title=\"apache\u600e\u4e48\u5220\u9664\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d\u63d2\u56fe\" alt=\"apache\u600e\u4e48\u5220\u9664\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5220\u9664 Apache \u4e2d\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d<\/strong><\/p>\n<p><strong>\u56de\u7b54\uff1a<\/strong><\/p>\n<p>\u8981\u5220\u9664 Apache \u4e2d\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d\uff0c\u60a8\u9700\u8981\u7f16\u8f91 Apache \u914d\u7f6e\u6587\u4ef6\u5e76\u5220\u9664 ServerName \u6307\u4ee4\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u5b9a\u4f4d\u914d\u7f6e\u6587\u4ef6\uff1a<\/strong><\/p>\n<ul>\n<li>\u5bf9\u4e8e Apache 2.4 \u53ca\u66f4\u65e9\u7248\u672c\uff0c\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e \/etc\/2\/httpd.conf\u3002<\/li>\n<li>\u5bf9\u4e8e Apache 2.4 \u53ca\u66f4\u9ad8\u7248\u672c\uff0c\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e \/etc\/apache2\/apache2.conf\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\uff1a<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982 nano\u3001vim \u6216 gedit\uff09\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5220\u9664\u591a\u4f59\u7684 ServerName \u6307\u4ee4\uff1a<\/strong><\/p>\n<ul>\n<li>\u627e\u5230 ServerName \u6307\u4ee4\u3002\u8be5\u6307\u4ee4\u6307\u5b9a\u670d\u52a1\u5668\u7684\u540d\u79f0\u6216 IP \u5730\u5740\u3002<\/li>\n<li>\u5220\u9664\u4e0d\u9700\u8981\u7684 ServerName \u6307\u4ee4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4fdd\u5b58\u5e76\u91cd\u542f Apache\uff1a<\/strong><\/p>\n<ul>\n<li>\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n<li>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u542f Apache\uff1a<\/p>\n<ul>\n<li>Ubuntu\/Debian\uff1asudo systemctl restart apache2<\/li>\n<li>CentOS\/Red Hat\uff1asudo systemctl restart httpd<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u5047\u8bbe Apache \u914d\u7f6e\u6587\u4ef6\u5305\u542b\u4ee5\u4e0b\u670d\u52a1\u5668\u540d\uff1a<\/p>\n<pre>ServerName example.com\nServerName example2.com<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8981\u5220\u9664 example2.com\uff0c\u8bf7\u5220\u9664\u5305\u542b\u8be5\u670d\u52a1\u5668\u540d\u7684\u884c\uff1a<\/p>\n<pre>ServerName example2.com<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u66f4\u65b0\u540e\u7684\u914d\u7f6e\u6587\u4ef6\u5c06\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>ServerName example.com<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5220\u9664\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u5220\u9664 apache \u4e2d\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d\uff0c\u8bf7\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\u5e76\u5220\u9664 servername \u6307\u4ee4\uff1a\u5b9a\u4f4d\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4e3a \/etc\/apache2\/httpd.conf \u6216 \/etc\/apache2\/apache2.conf\uff09\u3002\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u5e76\u5220\u9664\u4e0d\u9700\u8981\u7684 servername \u6307\u4ee4\u3002\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u542f apache\uff1aubuntu\/debian\uff1asudo systemctl restart apache2\uff1bcentos\/red hat\uff1asudo systemctl restart httpd\u3002 \u5982\u4f55\u5220\u9664 Apache \u4e2d\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d \u56de\u7b54\uff1a \u8981\u5220\u9664 Apache \u4e2d\u591a\u4f59\u7684\u670d\u52a1\u5668\u540d\uff0c\u60a8\u9700\u8981\u7f16\u8f91 Apache \u914d\u7f6e\u6587\u4ef6\u5e76\u5220\u9664 ServerName \u6307\u4ee4\u3002 \u8be6\u7ec6\u6b65\u9aa4\uff1a \u5b9a\u4f4d\u914d\u7f6e\u6587\u4ef6\uff1a \u5bf9\u4e8e Apache 2.4 \u53ca\u66f4\u65e9\u7248\u672c\uff0c\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e \/etc\/2\/httpd.conf\u3002 \u5bf9\u4e8e Apache 2.4 \u53ca\u66f4\u9ad8\u7248\u672c\uff0c\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e \/etc\/apache2\/apache2.conf\u3002 \u6253\u5f00\u914d\u7f6e\u6587\u4ef6\uff1a \u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982 nano\u3001vim \u6216 gedit\uff09\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u3002 \u5220\u9664\u591a\u4f59\u7684 ServerName \u6307\u4ee4\uff1a \u627e\u5230 ServerName \u6307\u4ee4\u3002\u8be5\u6307\u4ee4\u6307\u5b9a\u670d\u52a1\u5668\u7684\u540d\u79f0\u6216 IP \u5730\u5740\u3002 \u5220\u9664\u4e0d\u9700\u8981\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63643","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63643"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63643\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}