{"id":43728,"date":"2024-10-06T07:57:07","date_gmt":"2024-10-05T23:57:07","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43728\/"},"modified":"2024-10-06T07:57:07","modified_gmt":"2024-10-05T23:57:07","slug":"centos-7-3-%e7%92%b0%e5%a2%83%e4%b8%8b%e6%ba%90%e7%a2%bc%e5%ae%89%e8%a3%9d-httpd-2-4","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43728\/","title":{"rendered":"CentOS 7.3 \u74b0\u5883\u4e0b\u6e90\u78bc\u5b89\u88dd httpd 2.4"},"content":{"rendered":"<h1 id=\"centos-7-3-%e7%92%b0%e5%a2%83%e4%b8%8b%e6%ba%90%e7%a2%bc%e5%ae%89%e8%a3%9d-httpd-2-4-kLbwBnvhuh\">CentOS 7.3 \u74b0\u5883\u4e0b\u6e90\u78bc\u5b89\u88dd httpd 2.4<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0cApache HTTP Server\uff08\u7c21\u7a31 httpd\uff09\u662f\u6700\u53d7\u6b61\u8fce\u7684\u7db2\u9801\u4f3a\u670d\u5668\u4e4b\u4e00\u3002\u5b83\u7684\u7a69\u5b9a\u6027\u548c\u9748\u6d3b\u6027\u4f7f\u5176\u6210\u70ba\u8a31\u591a\u7db2\u7ad9\u7684\u9996\u9078\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7.3 \u74b0\u5883\u4e0b\u5f9e\u6e90\u78bc\u5b89\u88dd httpd 2.4\uff0c\u4e26\u63d0\u4f9b\u8a73\u7d30\u7684\u6b65\u9a5f\u548c\u6ce8\u610f\u4e8b\u9805\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-kLbwBnvhuh\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd\u4e4b\u524d\uff0c\u78ba\u4fdd\u4f60\u7684 CentOS 7.3 \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305\uff0c\u9019\u4e9b\u5305\u5c07\u5e6b\u52a9\u6211\u5011\u7de8\u8b6f\u548c\u5b89\u88dd httpd\uff1a<\/p>\n<pre><code>sudo yum install -y gcc make apr apr-devel pcre pcre-devel openssl openssl-devel<\/code><\/pre>\n<h2 id=\"%e4%b8%8b%e8%bc%89-httpd-2-4-%e6%ba%90%e7%a2%bc-kLbwBnvhuh\">\u4e0b\u8f09 httpd 2.4 \u6e90\u78bc<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u9700\u8981\u4e0b\u8f09 httpd 2.4 \u7684\u6e90\u78bc\u3002\u53ef\u4ee5\u5f9e Apache \u5b98\u65b9\u7db2\u7ad9\u7372\u53d6\u6700\u65b0\u7248\u672c\u7684\u6e90\u78bc\u5305\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f09\uff1a<\/p>\n<pre><code>wget https:\/\/downloads.apache.org\/httpd\/httpd-2.4.x.tar.gz<\/code><\/pre>\n<p>\u8acb\u5c07\u4e0a\u9762\u7684 &#8220;2.4.x&#8221; \u66ff\u63db\u70ba\u4f60\u60f3\u8981\u7684\u5177\u9ad4\u7248\u672c\u865f\u3002\u4e0b\u8f09\u5b8c\u6210\u5f8c\uff0c\u89e3\u58d3\u7e2e\u6e90\u78bc\u5305\uff1a<\/p>\n<pre><code>tar -zxvf httpd-2.4.x.tar.gz<\/code><\/pre>\n<h2 id=\"%e7%b7%a8%e8%ad%af%e5%92%8c%e5%ae%89%e8%a3%9d-httpd-kLbwBnvhuh\">\u7de8\u8b6f\u548c\u5b89\u88dd httpd<\/h2>\n<p>\u9032\u5165\u89e3\u58d3\u5f8c\u7684\u76ee\u9304\uff1a<\/p>\n<pre><code>cd httpd-2.4.x<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u914d\u7f6e\u7de8\u8b6f\u9078\u9805\uff1a<\/p>\n<pre><code>.\/configure --prefix=\/usr\/local\/apache2 --enable-so --enable-ssl --with-included-apr<\/code><\/pre>\n<p>\u9019\u88e1\u7684\u9078\u9805\u89e3\u91cb\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><code>--prefix<\/code>: \u6307\u5b9a\u5b89\u88dd\u76ee\u9304\u3002<\/li>\n<li><code>--enable-so<\/code>: \u555f\u7528\u52d5\u614b\u6a21\u7d44\u652f\u6301\u3002<\/li>\n<li><code>--enable-ssl<\/code>: \u555f\u7528 SSL \u652f\u6301\u3002<\/li>\n<li><code>--with-included-apr<\/code>: \u4f7f\u7528\u5167\u5efa\u7684 APR \u5eab\u3002<\/li>\n<\/ul>\n<p>\u914d\u7f6e\u5b8c\u6210\u5f8c\uff0c\u958b\u59cb\u7de8\u8b6f\u548c\u5b89\u88dd\uff1a<\/p>\n<pre><code>make<\/code><\/pre>\n<pre><code>sudo make install<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-httpd-kLbwBnvhuh\">\u914d\u7f6e httpd<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0chttpd \u7684\u4e3b\u914d\u7f6e\u6587\u4ef6\u4f4d\u65bc <code>\/usr\/local\/apache2\/conf\/httpd.conf<\/code>\u3002\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7de8\u8f2f\u5668\u6253\u958b\u4e26\u9032\u884c\u5fc5\u8981\u7684\u914d\u7f6e\uff1a<\/p>\n<pre><code>sudo vi \/usr\/local\/apache2\/conf\/httpd.conf<\/code><\/pre>\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u4f60\u53ef\u4ee5\u8a2d\u7f6e\u4f3a\u670d\u5668\u540d\u7a31\u3001\u7aef\u53e3\u865f\u3001\u6587\u6a94\u6839\u76ee\u9304\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u914d\u7f6e\u793a\u4f8b\uff1a<\/p>\n<pre><code>ServerName localhost:80\nDocumentRoot \"\/usr\/local\/apache2\/htdocs\"\n\n    Options Indexes FollowSymLinks\n    AllowOverride None\n    Require all granted\n\n<\/code><\/pre>\n<h2 id=\"%e5%95%9f%e5%8b%95-httpd-%e4%bc%ba%e6%9c%8d%e5%99%a8-kLbwBnvhuh\">\u555f\u52d5 httpd \u4f3a\u670d\u5668<\/h2>\n<p>\u914d\u7f6e\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u555f\u52d5 httpd \u4f3a\u670d\u5668\uff1a<\/p>\n<pre><code>\/usr\/local\/apache2\/bin\/apachectl start<\/code><\/pre>\n<p>\u8981\u6aa2\u67e5 httpd \u662f\u5426\u6b63\u5e38\u904b\u884c\uff0c\u53ef\u4ee5\u5728\u700f\u89bd\u5668\u4e2d\u8f38\u5165 <code>http:\/\/localhost<\/code>\uff0c\u5982\u679c\u770b\u5230 Apache \u7684\u6b61\u8fce\u9801\u9762\uff0c\u5247\u8868\u793a\u5b89\u88dd\u6210\u529f\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-kLbwBnvhuh\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS 7.3 \u74b0\u5883\u4e0b\u6e90\u78bc\u5b89\u88dd httpd 2.4 \u7684\u904e\u7a0b\u76f8\u5c0d\u7c21\u55ae\uff0c\u53ea\u9700\u9075\u5faa\u4e0a\u8ff0\u6b65\u9a5f\u5373\u53ef\u5b8c\u6210\u3002\u9019\u7a2e\u5b89\u88dd\u65b9\u5f0f\u4e0d\u50c5\u80fd\u8b93\u4f60\u7372\u5f97\u6700\u65b0\u7248\u672c\u7684 httpd\uff0c\u9084\u80fd\u6839\u64da\u9700\u8981\u9032\u884c\u81ea\u5b9a\u7fa9\u914d\u7f6e\u3002\u5982\u679c\u4f60\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u670d\u52d9\u4f86\u904b\u884c\u4f60\u7684\u7db2\u7ad9\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u9069\u5408\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u7121\u8ad6\u662f <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u9084\u662f\u5176\u4ed6\u5730\u5340\u7684\u670d\u52d9\uff0c\u5747\u53ef\u6eff\u8db3\u4f60\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install Apache HTTP Server 2.4 from source on CentOS 7.3 with step-by-step instructions for a seamless setup.<\/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-43728","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43728","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=43728"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43728\/revisions"}],"predecessor-version":[{"id":43729,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43728\/revisions\/43729"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}