{"id":174809,"date":"2020-03-24T21:34:45","date_gmt":"2020-03-24T13:34:45","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=174809"},"modified":"2020-03-24T12:16:26","modified_gmt":"2020-03-24T04:16:26","slug":"source-code-apache2-4","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/source-code-apache2-4.html","title":{"rendered":"\u6e90\u7801\u7f16\u8bd1 apache2.4"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u672c\u6587\u6863\u5b9e\u6218\u6f14\u793a\u6e90\u7801\u7f16\u8bd1 apache2.4\uff0c\u6765\u81ea\u4f20\u68cb\u7684\u539f\u521b\u6587\u6863\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u672c\u6587\u6863\u4f7f\u7528\u7684\u6e90\u7801\u5305\u5730\u5740
\n\u94fe\u63a5\uff1ahttps:\/\/pan.baidu.com\/s\/110RWf3VC8J3oJhgYq5jU2w<\/a>
\n\u63d0\u53d6\u7801\uff1apdc0<\/p>\n

\u5b9e\u6218<\/strong><\/div>\n
[root@Jaking12 ~]# yum install -y gcc  pcre  pcre-devel  expat-devel   bzip2  openssl-devel   zlib*  libtool\r\n[root@Jaking12 src]# rz\r\n[root@Jaking12 src]# tar xvf apr-1.7.0.tar.gz\r\n[root@Jaking12 src]# ls\r\napr-1.7.0  apr-1.7.0.tar.gz\r\n[root@Jaking12 src]# cd apr-1.7.0\r\n[root@Jaking12 apr-1.7.0]# .\/configure  --prefix=\/usr\/local\/apr\r\n[root@Jaking12 apr-1.7.0]# make\r\n[root@Jaking12 apr-1.7.0]# make install\r\n\r\n[root@Jaking12 apr-1.7.0]# cd ..\r\n[root@Jaking12 src]# rz\r\nrz waiting to receive.\r\n zmodem trl+C \u0221\r\n\r\n  100%     541 KB  541 KB\/s 00:00:01       0 Errors..\r\n\r\n[root@Jaking12 src]# ls\r\napr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz\r\n[root@Jaking12 src]# tar xf apr-util-1.6.1.tar.gz \r\n[root@Jaking12 src]# ls\r\napr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1  apr-util-1.6.1.tar.gz\r\n[root@Jaking12 src]# cd apr-util-1.6.1\r\n[root@Jaking12 apr-util-1.6.1]# .\/configure --prefix=\/usr\/local\/apr-util  --with-apr=\/usr\/local\/apr\r\n[root@Jaking12 apr-util-1.6.1]# make\r\n[root@Jaking12 apr-util-1.6.1]# make install\r\n<\/pre>\n
\u66f4\u591a\u7684\u9009\u9879\u53ef\u4ee5\u901a\u8fc7.\/configure --help \u4e86\u89e3\r\n\u5b98\u65b9\u7684\u7f16\u8bd1\u9009\u9879\u6587\u6863http:\/\/httpd.apache.org\/docs\/current\/programs\/configure.html\r\n\r\n--prefix=\/usr\/local\/apache \r\n--sysconfdir=\/etc\/httpd         \/\/  \u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\u5728\u5b89\u88c5\u5728\u54ea\u4e2a\u8def\u5f84\u3002\u5982\u4e0d\u6307\u5b9a\uff0c\u914d\u7f6e\u6587\u4ef6\u5c31\u5728\u7a0b\u5e8f\u5b89\u88c5\u7684\u76ee\u5f55\uff1b\u5982\u6307\u5b9a\/etc\u76ee\u5f55\r\n--with-apr=\/usr\/local\/apr       \/\/ \u6307\u5b9a\u4f9d\u8d56\u7684apr\u8def\u5f84\u3002\u6ce8\u610f\u5fc5\u987b\u6307\u660e\u8def\u5f84\uff0c\u5426\u5219\u7f16\u8bd1\u65f6\u4f1a\u81ea\u52a8\u53bb\u627e\/usr\u4e0b\u7684apr\uff0c\u800c\u4e0d\u662f\u7f16\u8bd1\u7684\u9ad8\u7248\u672capr\uff0c\u4e0b\u540c\r\n--with-apr-util=\/usr\/local\/apr-util \r\n--with-mpm=MPM          \/\/\u6307\u5b9a\u9ed8\u8ba4\u7684    [prefork | worker | event]\t\u59823\u79cdMPM\u6a21\u5757\u90fd\u7f16\u8bd1\u4e86\uff0c\u5219\u901a\u8fc7\u6b64\u9879\u6307\u5b9a\u9ed8\u8ba4\u4f7f\u7528\u54ea\u79cd\r\n--with-pcre              \/\/\u4f9d\u8d56pcre\u5e93\u7528\u4e8e\u89e3\u51b3\u6b63\u5219\u8868\u8fbe\u5f0f\u95ee\u9898\u3002    ## \u5b89\u88c5  pcre-devel\uff08\u517c\u5bb9Perl\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5e93\uff09\r\n--enable-so             \/\/\u6253\u5f00 so \u6a21\u5757\uff0c\u542f\u7528\u52a8\u6001\u88c5\u8f7d\u6a21\u5757\u529f\u80fd\r\n--enable-ssl             \/\/\u542f\u7528ssl\u529f\u80fd\u3002\u6ce8\u610f\u8981\u5148\u5b89\u88c5\uff0chttps\u4f7f\u7528\r\n--enable-cgi            \/\/\u542f\u7528cgi\u529f\u80fd\uff0c\u4e3a\u975e\u7ebf\u7a0b\u65b9\u5f0f\u5de5\u4f5c\u7684mpm\u4f7f\u7528\r\n--enable-cgid         \/\/\u4ee5\u7ebf\u7a0b\u5de5\u4f5c\uff08worker\/event\uff09\u7684mpm\u4f7f\u7528\r\n--enable-rewrite     \/\/\u652f\u6301 URL \u91cd\u5199\r\n--enable-zlib          \/\/\u901a\u7528\u538b\u7f29\u673a\u5236\r\n--enable-module=most      \/\/[ all | most | \u2026\u2026]\t\u6307\u5b9a\u542f\u7528\u54ea\u4e9b\u6a21\u5757\u3002\u53ef\u6307\u5b9a\u5177\u4f53\u7684\u6a21\u5757\u540d\uff0c\u4e5f\u53ef\u4f7f\u7528all\u8868\u793a\u542f\u7528\u6240\u6709\u6a21\u5757\uff0cmost\u8868\u793a\u542f\u7528\u5927\u591a\u6570\u5e38\u7528\u6a21\u5757\u3002\r\n                                        \u4e00\u822c\u4f7f\u7528most\u5373\u53ef\r\n--enable-mpms-shared=all        \/\/\u542f\u7528MPM\u652f\u6301\u7684\u6a21\u5f0f,\u542f\u7528\u54ea\u79cdmpm(prefork\uff0cworker\uff0cevent)\uff0c\u4f7f\u7528worker\u6216event\u65f6\u8981\u53e6\u5916\u4e00\u79cd\u65b9\u5f0f\u7f16\u8bd1php(\u7f16\u8bd1\u65f6\u4f7f\u7528\u4e86\u2013enable-maintainer-zts\u9009\u9879)\r\n--enable-deflate       \/\/\u4f20\u8f93\u538b\u7f29\u673a\u5236\uff0c\u8282\u7ea6\u5e26\u5bbd\u63d0\u4f9b\u5bf9\u5185\u5bb9\u7684\u538b\u7f29\u4f20\u8f93\u7f16\u7801\u652f\u6301\u4e00\u822c\u662fhtml\u3001js\u3001css\u7b49\u5185\u5bb9\u7684\u7ad9\u70b9\u3002\u4f7f\u7528\u6b64\u53c2\u6570\u4f1a\u5927\u5927\r\n                                 \u63d0\u9ad8\u4f20\u8f93\u901f\u5ea6\u63d0\u5347\u8bbf\u95ee\u8005\u8bbf\u95ee\u7684\u4f53\u9a8c\u3002\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u8fd9\u662fapache\u8c03\u4f18\u7684\u4e00\u4e2a\u91cd\u8981\u9009\u9879\u4e4b\u4e00\r\n<\/pre>\n
[root@Jaking12 apr-util-1.6.1]# cd ..\r\n[root@Jaking12 src]# rz\r\nrz waiting to receive.\r\n zmodem trl+C \u0221\r\n\r\n  100%    8983 KB 8983 KB\/s 00:00:01       0 Errors\r\n\r\n[root@Jaking12 src]# ls\r\napr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1  apr-util-1.6.1.tar.gz  httpd-2.4.39.tar.gz\r\n[root@Jaking12 src]# tar xf httpd-2.4.39.tar.gz \r\n[root@Jaking12 src]# ls\r\napr-1.7.0         apr-util-1.6.1         httpd-2.4.39\r\napr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.39.tar.gz\r\n[root@Jaking12 src]# cd httpd-2.4.39\r\n[root@Jaking12 httpd-2.4.39]# .\/configure --prefix=\/usr\/local\/apache24  --enable-so  --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=\/usr\/local\/apr --with-apr-util=\/usr\/local\/apr-util --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all  --with-mpm=event\r\n[root@Jaking12 httpd-2.4.39]# make \r\n[root@Jaking12 httpd-2.4.39]# make install\r\n\r\n\u6240\u6709\u7ec4\u4ef6        \/usr\/local\/apache24   \r\n\u4e3b\u914d\u7f6e\u6587\u4ef6    \/usr\/local\/apache24\/conf   \r\n\u542f\u52a8\u811a\u672c       \/usr\/local\/apache24\/bin\/apachectl\r\n\r\n[root@Jaking12 httpd-2.4.39]# ls \/usr\/local\/apache24\/\r\nbin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules\r\n[root@Jaking12 httpd-2.4.39]# ls \/usr\/local\/apache24\/conf\/\r\nextra  httpd.conf  magic  mime.types  original\r\n[root@Jaking12 httpd-2.4.39]# ls \/usr\/local\/apache24\/bin\/\r\nab         apxs      dbmmanage  envvars-std  htcacheclean  htdigest  httpd      logresolve\r\napachectl  checkgid  envvars    fcgistarter  htdbm         htpasswd  httxt2dbm  rotatelogs\r\n[root@Jaking12 httpd-2.4.39]# ll \/usr\/local\/apache24\/bin\/apachectl  \r\n-rwxr-xr-x 1 root dip 3440 Mar 10 16:45 \/usr\/local\/apache24\/bin\/apachectl\r\n<\/pre>\n
\u542f\u52a8 apache2.4<\/strong><\/div>\n
[root@Jaking12 httpd-2.4.39]# \/usr\/local\/apache24\/bin\/apachectl\r\nAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::250:56ff:fe2c:fe97%ens33. Set the 'ServerName' directive globally to suppress this message\r\n\u8fd9\u662f\u4e00\u4e2a\u63d0\u793a\uff0c\u95ee\u9898\u4e0d\u5927 (\u2299o\u2299)\u2026\r\n<\/pre>\n
\u91cd\u542f apache2.4<\/strong><\/div>\n
[root@Jaking12 httpd-2.4.39]# \/usr\/local\/apache24\/bin\/apachectl graceful \r\n<\/pre>\n
\u67e5\u770b apache2.4 \u76f8\u5173\u4fe1\u606f<\/strong><\/div>\n
[root@Jaking12 httpd-2.4.39]# netstat -pantul | grep 80\r\ntcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      807\/sshd            \r\ntcp6       0      0 :::80                   :::*                    LISTEN      35199\/httpd         \r\ntcp6       0      0 :::22                   :::*                    LISTEN      807\/sshd  \r\n[root@Jaking12 httpd-2.4.39]# grep DocumentRoot \/usr\/local\/apache24\/conf\/httpd.conf    \r\n# DocumentRoot: The directory out of which you will serve your\r\nDocumentRoot \"\/usr\/local\/apache24\/htdocs\"\r\n    # access content that does not live under the DocumentRoot.\r\n[root@Jaking12 httpd-2.4.39]# ls \/usr\/local\/apache24\/htdocs\r\nindex.html\r\n[root@Jaking12 httpd-2.4.39]# cat \/usr\/local\/apache24\/htdocs\/index.html\r\nIt works!\r\n<\/pre>\n

\"\"<\/p>\n

\u81ea\u5b9a\u4e49\u9996\u9875\u5185\u5bb9<\/strong><\/div>\n
[root@Jaking12 httpd-2.4.39]# vim \/usr\/local\/apache24\/htdocs\/index.html\r\nIt works!\r\nHello World!\r\n<\/pre>\n

\"\"<\/p>\n

\u8bbe\u7f6e\u6587\u4ef6\u5171\u4eab\u670d\u52a1<\/strong><\/div>\n
[root@Jaking12 httpd-2.4.39]# cd \/usr\/local\/apache24\/htdocs\/\r\n[root@Jaking12 htdocs]# ls\r\nindex.html\r\n[root@Jaking12 htdocs]# touch file{1..10}\r\n[root@Jaking12 htdocs]# ls\r\nfile1  file10  file2  file3  file4  file5  file6  file7  file8  file9  index.html\r\n[root@Jaking12 htdocs]# mv index.html index.html.bak\r\n[root@Jaking12 htdocs]# ls\r\nfile1  file10  file2  file3  file4  file5  file6  file7  file8  file9  index.html.bak\r\n<\/pre>\n

\"\"<\/p>\n

\u603b\u7ed3<\/strong><\/div>\n

\u81f3\u6b64\uff0c\u5b9e\u6218\u6f14\u793a\u6e90\u7801\u7f16\u8bd1 apache2.4\u5b8c\u6bd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u672c\u6587\u6863\u4f7f\u7528\u7684\u6e90\u7801\u5305\u5730\u5740 \u94fe\u63a5\uff1ahttps:\/\/pan.baidu.com\/s\/110RWf3VC8J3oJhg […]<\/p>\n","protected":false},"author":63,"featured_media":174813,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-174809","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=174809"}],"version-history":[{"count":10,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174809\/revisions"}],"predecessor-version":[{"id":175355,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174809\/revisions\/175355"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/174813"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=174809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=174809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=174809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}