{"id":39426,"date":"2024-11-26T15:37:11","date_gmt":"2024-11-26T07:37:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/39426\/"},"modified":"2024-11-26T15:37:11","modified_gmt":"2024-11-26T07:37:11","slug":"centos%e4%b9%8b%e6%90%ad%e5%bb%baapache%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/39426\/","title":{"rendered":"centos\u4e4b\u642d\u5efaApache\u73af\u5883"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/172950514060995.jpg\" class=\"aligncenter\" title=\"centos\u4e4b\u642d\u5efaApache\u73af\u5883\u63d2\u56fe\" alt=\"centos\u4e4b\u642d\u5efaApache\u73af\u5883\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4e00\u3001\u5b89\u88c5<\/strong>  <\/p>\n<p>\u5b89\u88c5\u4e4b\u524d\u5148\u5c06\u670d\u52a1\u5668\u7684\u9632\u706b\u5899\u5173\u6389\u3002<\/p>\n<pre>systemctl stop firewalld\n\nsystemctl disable firewall\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a<\/p>\n<p>\u5b89\u88c5apr<\/p>\n<p>\u4e0b\u8f7d\uff1a<\/p>\n<pre>wget -c http:\/\/mirrors.tuna.tsinghua.edu.cn\/apache\/\/apr\/apr-1.6.3.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u89e3\u538b\u8be5\u6587\u4ef6\uff1a<\/p>\n<pre>tar -jvxf apr-1.6.3.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u68c0\u6d4b\uff1a<\/p>\n<pre>cd apr-1.6.3\n.\/configure --prefix=\/usr\/local\/apr\/\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7f16\u8bd1\uff1a<\/p>\n<pre>make\nmake install\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a<\/p>\n<p>\u5b89\u88c5apr-util<\/p>\n<p>\u4e0b\u8f7d\uff1a<\/p>\n<pre>wget -c http:\/\/mirrors.tuna.tsinghua.edu.cn\/apache\/\/apr\/apr-util-1.6.1.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u89e3\u538b\u8be5\u6587\u4ef6\uff1a<\/p>\n<pre>tar -jvxf apr-util-1.6.1.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u68c0\u6d4b\uff1a<\/p>\n<pre>cd apr-util-1.6.3\n.\/configure --prefix=\/usr\/local\/apr-util\/ --with-apr=\/usr\/local\/apr\/\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7f16\u8bd1\uff1a<\/p>\n<pre>make\nmake install\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a<\/p>\n<p>\u5b89\u88c5pcre<\/p>\n<p>\u4e0b\u8f7d\uff1a<\/p>\n<pre>wget -c http:\/\/ftp.pcre.org\/pub\/pcre\/pcre-8.42.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u89e3\u538b\u8be5\u6587\u4ef6\uff1a<\/p>\n<pre>tar -jvxf pcre-8.42.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u68c0\u6d4b\uff1a<\/p>\n<pre>cd pcre-8.42\n.\/configure --prefix=\/usr\/local\/pcre\/\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7f16\u8bd1\uff1a<\/p>\n<pre>make\nmake install\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u56db\u6b65\uff1a<br \/> \u5b89\u88c5httpd<\/p>\n<p>\u4e0b\u8f7d\uff1a<\/p>\n<pre>wget -c http:\/\/mirrors.cnnic.cn\/apache\/httpd\/httpd-2.4.29.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u89e3\u538b\u8be5\u6587\u4ef6\uff1a<\/p>\n<pre>tar -jvxf httpd-2.4.29.tar.bz2\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u68c0\u6d4b\uff1a<\/p>\n<pre>cd httpd-2.4.29\n.\/configure --prefix=\/usr\/local\/httpd\/ --with-apr=\/usr\/local\/apr\/ --with-apr-util=\/usr\/local\/apr-util\/ --with-pcre=\/usr\/local\/pcre\/\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7f16\u8bd1\uff1a<\/p>\n<pre>make\nmake install\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e94\u6b65\uff1a<\/p>\n<pre>\u914d\u7f6e\/usr\/local\/apache2\/conf\/httpd.conf\n\nServerName www.examda.com:80\n\u6539\u4e3a\nServerName localhost:80\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u516d\u6b65\uff1a<\/p>\n<p>\u542f\u52a8apache\u670d\u52a1<\/p>\n<pre>\/usr\/local\/apache2\/bin\/apachectl start\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236<br \/>\n<strong>\u4e8c\u3001\u68c0\u6d4b<br \/><\/strong>  <\/p>\n<p>\u4f7f\u7528\u6d4f\u89c8\u5668\u8bbf\u95ee\u672c\u5730IP<\/p>\n<p>\u51fa\u73b0It works!\u6210\u529f<\/p>\n<p><strong>\u4e09\u3001\u62a5\u9519\u5904\u7406<\/strong>  <\/p>\n<p>\uff081\uff09configure: error: APR not found. Please read the documentation.<\/p>\n<p>\u8fd9\u662f\u6ca1\u6709\u5b89\u88c5apr\u6216\u8005apr\u5b89\u88c5\u5931\u8d25\u5bfc\u81f4\u7684\uff0c\u91cd\u65b0\u5b89\u88c5apr\u3002<\/p>\n<p>\u5b89\u88c5\u8bf7\u67e5\u770b\u7b2c\u4e00\u6b65\u3002<\/p>\n<p>\uff082\uff09configure: error: APR-util not found. Please read the documentation.<\/p>\n<p>\u8fd9\u662f\u6ca1\u6709\u5b89\u88c5apr-util\u6216\u8005apr-util\u5b89\u88c5\u5931\u8d25\u5bfc\u81f4\u7684\uff0c\u91cd\u65b0\u5b89\u88c5apr-util\u3002<\/p>\n<p>\u5b89\u88c5\u8bf7\u67e5\u770b\u7b2c\u4e8c\u6b65\u3002<\/p>\n<p>\uff083\uff09configure: error: no acceptable C compiler found in $PATH<\/p>\n<p>\u8fd9\u662f\u6ca1\u6709\u5b89\u88c5gcc\u7f16\u8bd1\u5668\u6216\u8005gcc\u7f16\u8bd1\u5668\u5b89\u88c5\u5931\u8d25\u5bfc\u81f4\u7684\uff0c\u91cd\u65b0\u5b89\u88c5gcc\u3002<\/p>\n<pre>yum install -y gcc\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\uff084\uff09xml\/apr_xml.c:35:19: \u81f4\u547d\u9519\u8bef\uff1aexpat.h\uff1a\u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55<\/p>\n<p>\u8fd9\u662f\u6ca1\u6709\u5b89\u88c5expat-devel\u6216\u8005expat-devel\u5b89\u88c5\u5931\u8d25\u5bfc\u81f4\u7684\uff0c\u91cd\u65b0\u5b89\u88c5expat-devel\u3002<\/p>\n<pre>yum install -y expat-devel\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\uff085\uff09configure: error: Invalid C++ compiler or C++ compiler flags<\/p>\n<p>\u8fd9\u662f\u6ca1\u6709\u5b89\u88c5gcc-c++\u6216\u8005gcc-c++\u5b89\u88c5\u5931\u8d25\u5bfc\u81f4\u7684\uff0c\u91cd\u65b0\u5b89\u88c5gcc-c++\u3002<\/p>\n<pre>yum install -y gcc-c++\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\uff086\uff09configure: error: pcre-config for libpcre not found. PCRE is required and available from http:\/\/pcre.org\/<\/p>\n<p>\u8fd9\u662f\u6ca1\u6709\u5b89\u88c5pcre\u6216\u8005pcre\u5b89\u88c5\u5931\u8d25\u5bfc\u81f4\u7684\uff0c\u91cd\u65b0\u5b89\u88c5pcre\u3002<\/p>\n<p>\u5b89\u88c5\u8bf7\u67e5\u770b\u7b2c\u4e09\u6b65\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fcentos\u4e4b\u642d\u5efaApache\u73af\u5883\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u5b89\u88c5 \u5b89\u88c5\u4e4b\u524d\u5148\u5c06\u670d\u52a1\u5668\u7684\u9632\u706b\u5899\u5173\u6389\u3002 systemctl stop firewalld systemctl disable firewall \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u4e00\u6b65\uff1a \u5b89\u88c5apr \u4e0b\u8f7d\uff1a wget -c http:\/\/mirrors.tuna.tsinghua.edu.cn\/apache\/\/apr\/apr-1.6.3.tar.bz2 \u767b\u5f55\u540e\u590d\u5236 \u89e3\u538b\u8be5\u6587\u4ef6\uff1a tar -jvxf apr-1.6.3.tar.bz2 \u767b\u5f55\u540e\u590d\u5236 \u68c0\u6d4b\uff1a cd apr-1.6.3 .\/configure &#8211;prefix=\/usr\/local\/apr\/ \u767b\u5f55\u540e\u590d\u5236 \u7f16\u8bd1\uff1a make make install \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u4e8c\u6b65\uff1a \u5b89\u88c5apr-util \u4e0b\u8f7d\uff1a wget -c http:\/\/mirrors.tuna.tsinghua.edu.cn\/apache\/\/apr\/apr-util-1.6.1.tar.bz2 \u767b\u5f55\u540e\u590d\u5236 \u89e3\u538b\u8be5\u6587\u4ef6\uff1a tar -jvxf apr-util-1.6.1.tar.bz2 \u767b\u5f55\u540e\u590d\u5236 \u68c0\u6d4b\uff1a cd apr-util-1.6.3 .\/configure &#8211;prefix=\/usr\/local\/apr-util\/ &#8211;with-apr=\/usr\/local\/apr\/ \u767b\u5f55\u540e\u590d\u5236 \u7f16\u8bd1\uff1a [&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-39426","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39426","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=39426"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39426\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=39426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=39426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=39426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}