{"id":36960,"date":"2023-01-21T05:47:51","date_gmt":"2022-11-11T13:12:40","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/"},"modified":"2024-04-29T10:43:59","modified_gmt":"2024-04-29T02:43:59","slug":"%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/","title":{"rendered":"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09"},"content":{"rendered":"<p>\u4e16\u754c\u4e0a\u6700\u5e38\u7528\u7684Web\u670d\u52a1\u5668\u662fApache http server\u3002\u7531\u4e8eCentOS7\u53d8\u4e3asystemd\uff0c\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\u800c\u4e0d\u662f\u4f7f\u7528rpm\u65f6\uff0c\u542f\u52a8\u811a\u672c\u53ef\u80fd\u4f1a\u51fa\u73b0\u65e0\u54cd\u5e94\u7684\u95ee\u9898\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u5c06\u4f7f\u7528CentOS7.2\u539f\u751f\u7684\u542f\u52a8\u811a\u672c\u8fdb\u884c\u66f4\u6539\u3002\u57282016\u5e7412\u670824\u65e5\u7684\u66f4\u65b0\u4e2d\uff0c\u901a\u8fc7\u8fdb\u884cmod_systemd\u7684\u56de\u6eaf\uff0c\u5c06\u5176\u6539\u4e3a\u4e0esystemd\u517c\u5bb9\u7684\u5f62\u5f0f\u3002\u867d\u7136\u6211\u4eec\u662f\u5728RockyLinux\u4e0a\u8fdb\u884c\u64cd\u4f5c\uff0c\u4f46\u5176\u4ed6\u517c\u5bb9RHEL\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e5f\u53ef\u4ee5\u91c7\u53d6\u76f8\u540c\u7684\u64cd\u4f5c\u3002<\/p>\n<p>2023\u5e745\u6708\u76ee\u524d\uff0cApache\u7248\u672c\u70ba\u300c2.4.57\u300d\u3002<br \/>\n\u5982\u679c\u8981\u555f\u7528SSL\u652f\u6301\uff0c\u9700\u8981\u5b89\u88ddOpenSSL\u3002<br \/>\n\u95dc\u65bcOpenSSL\u7684\u5b89\u88dd\uff0c\u8acb\u53c3\u8003\u5728RockeyLinux 8.4\u4e0a\u5b89\u88ddOpenSSL\uff081.0.x\uff09\uff08\u5f9e\u6e90\u78bc\u7de8\u8b6f\uff09\u6307\u5357\u3002<br \/>\n\u6b64\u5916\uff0c\u9084\u9700\u8981zlib\u3002\u5982\u679c\u60a8\u7684\u64cd\u4f5c\u7cfb\u7d71\u5df2\u7d93\u5167\u5efazlib\uff0c\u5247\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff0c\u4f46\u5982\u679c\u672a\u5b89\u88dd\uff0c\u8acb\u53c3\u8003\u5728CentOS 7.2\u4e0a\u5b89\u88ddzlib\uff08\u5f9e\u6e90\u78bc\u7de8\u8b6f\uff09\u6307\u5357\u3002<\/p>\n<h2>\u8bf7\u4e0b\u8f7d\u5230\u6307\u5b9a\u4f4d\u7f6e\u3002<\/h2>\n<p>APR\u76f8\u5173<\/p>\n<p>http:\/\/apr.apache.org\/<br \/>\nApache HTTP Server<\/p>\n<p>http:\/\/httpd.apache.org\/<br \/>\nPCRE<\/p>\n<p>http:\/\/www.pcre.org\/<br \/>\nzlib<br \/>\nhttp:\/\/www.zlib.net\/<\/p>\n<h2>\u5b9e\u9645\u73af\u5883\u7248\u672c\u4fe1\u606f<\/h2>\n<div>\n<div class=\"post-table\">\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u30d0\u30fc\u30b8\u30e7\u30f3apr1.7.4apr-util1.6.1Expat XML Parser2.4.3PCRE8.45zlib1.2.11apache http server2.4.57OSRockyLinux 8.4 and RockyLinux 9.0<\/div>\n<\/div>\n<p>\u5982\u679c\u4f7f\u7528rpm\u5305\u7ba1\u7406\u7cfb\u7edf\u5b89\u88c5\u4e86\u64cd\u4f5c\u7cfb\u7edf\u7684\u6807\u51c6Apache\u7248\u672c\uff0c\u9700\u8981\u5378\u8f7d\u5b83\u3002<\/p>\n<pre class=\"post-pre\"><code>rpm <span class=\"nt\">-e<\/span> httpd-devel-2.4.6-45.el7.centos.x86_64\r\nrpm <span class=\"nt\">-e<\/span> httpd-manual-2.4.6-45.el7.centos.noarch\r\nrpm <span class=\"nt\">-e<\/span> mod_ssl-2.4.6-45.el7.centos.x86_64\r\nrpm <span class=\"nt\">-e<\/span> mod_fcgid-2.3.9-4.el7.x86_64\r\nrpm <span class=\"nt\">-e<\/span> httpd-2.4.6-45.el7.centos.x86_64\r\nrpm <span class=\"nt\">-e<\/span> httpd-tools-2.4.6-45.el7.centos.x86_64\r\n<\/code><\/pre>\n<h2>\u5b89\u88c5\u6b65\u9aa4<\/h2>\n<h3>1. \u5b89\u88c5apr\u3002<\/h3>\n<pre class=\"post-pre\"><code><span class=\"nb\">cd<\/span> \/usr\/local\/src\r\nwget https:\/\/dlcdn.apache.org\/\/apr\/apr-1.7.4.tar.gz\r\n<span class=\"nb\">tar <\/span>xvzf apr-1.7.4.tar.gz\r\n<span class=\"nb\">cd <\/span>apr-1.7.4\r\n.\/configure\r\nmake <span class=\"nt\">-j<\/span> 8\r\nmake <span class=\"nb\">install<\/span>\r\n<\/code><\/pre>\n<h3>\u5b89\u88c5 Expat XML \u89e3\u6790\u5668\u3002<\/h3>\n<pre class=\"post-pre\"><code><span class=\"nb\">cd<\/span> \/usr\/local\/src\r\nwget https:\/\/github.com\/libexpat\/libexpat\/releases\/download\/R_2_5_0\/expat-2.5.0.tar.gz\r\n<span class=\"nb\">tar <\/span>xvzf expat-2.5.0.tar.gz\r\n<span class=\"nb\">cd <\/span>expat-2.5.0\r\n.\/configure\r\nmake <span class=\"nt\">-j<\/span> 8\r\nmake <span class=\"nb\">install<\/span>\r\n<\/code><\/pre>\n<h3>3. \u8fdb\u884capr-util\u7684\u5b89\u88c5\u3002<\/h3>\n<pre class=\"post-pre\"><code><span class=\"nb\">cd<\/span> \/usr\/local\/src\r\nwget https:\/\/dlcdn.apache.org\/\/apr\/apr-util-1.6.3.tar.gz\r\n<span class=\"nb\">tar <\/span>xvzf apr-util-1.6.3.tar.gz\r\n<span class=\"nb\">cd <\/span>apr-util-1.6.3\r\n.\/configure <span class=\"nt\">--with-apr<\/span><span class=\"o\">=<\/span>\/usr\/local\/apr <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--with-openssl<\/span><span class=\"o\">=<\/span>\/usr\/local\/ssl\r\nmake <span class=\"nt\">-j<\/span> 8\r\nmake <span class=\"nb\">install<\/span>\r\n<\/code><\/pre>\n<h3>4. \u5b89\u88c5PCRE<\/h3>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u5b89\u88c5PCRE\u3002<br \/>\n\u5bf9\u4e8eApache 2.4.56\u8fc1\u79fb\uff0c\u53ea\u9700\u5b89\u88c5PCRE2\u5373\u53ef\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">cd<\/span> \/usr\/local\/src\r\nwget <span class=\"s2\">\"https:\/\/downloads.sourceforge.net\/project\/pcre\/pcre\/8.45\/pcre-8.45.tar.gz?ts=gAAAAABkK_XztgvJ7mhpizK6AGN7erWqfpNYfQjfHoqVpEGHak8u8_zfm3hoHyp58CXruxGg3jmmRXrYsIqfrabhQDUgeGZ_jQ%3D%3D&amp;r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.45%2Fpcre-8.45.tar.gz%2Fdownload\"<\/span>\r\n\r\n<span class=\"nb\">tar <\/span>xvzf pcre-8.45.tar.gz\r\n<span class=\"nb\">cd <\/span>pcre-8.45\r\n.\/configure\r\nmake\r\nmake <span class=\"nb\">install<\/span>\r\n<\/code><\/pre>\n<h3>\u5b89\u88c5PCRE2\u3002\uff08\u4ece2.4.56\u7248\u672c\u5f00\u59cb\uff0c\u53ea\u9700\u5b89\u88c5PCRE2\uff01\uff09<\/h3>\n<pre class=\"post-pre\"><code>cd \/usr\/local\/src\r\nwget https:\/\/github.com\/PCRE2Project\/pcre2\/releases\/download\/pcre2-10.42\/pcre2-10.42.tar.gz\r\ntar xvzf pcre2-10.42.tar.gz\r\ncd pcre2-10.42\r\n.\/configure\r\nmake -j 8\r\nmake install\r\n<\/code><\/pre>\n<h3>\u5b89\u88c5zlib\u5e93<\/h3>\n<pre class=\"post-pre\"><code>cd \/usr\/local\/src\r\nwget https:\/\/zlib.net\/zlib-1.2.13.tar.gz\r\ntar xvzf zlib-1.2.13.tar.gz\r\ncd zlib-1.2.13\r\n.\/configure\r\nmake\r\nmake install\r\n<\/code><\/pre>\n<h3>6. \u5b89\u88c5Systemd-devel<\/h3>\n<pre class=\"post-pre\"><code>#RHEL\u7cfb\r\ndnf install systemd-devel\r\n\r\n#Ubuntu\r\nsudo apt-get install -y libsystemd-dev\r\n<\/code><\/pre>\n<h3>7. \u5b89\u88c5Apache<\/h3>\n<pre class=\"post-pre\"><code><span class=\"nb\">cd<\/span> \/usr\/local\/src\r\nwget https:\/\/dlcdn.apache.org\/httpd\/httpd-2.4.57.tar.gz\r\n<span class=\"nb\">tar <\/span>xvzf httpd-2.4.57.tar.gz\r\n<span class=\"nb\">cd <\/span>httpd-2.4.57\r\n<span class=\"c\">#PCRE2\u306e\u30bd\u30fc\u30b9\u306e\u5834\u6240\u3092\u9078\u629e<\/span>\r\n.\/configure <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--with-apr<\/span><span class=\"o\">=<\/span>\/usr\/local\/apr <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--with-apr-util<\/span><span class=\"o\">=<\/span>\/usr\/local\/apr <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--with-pcre<\/span><span class=\"o\">=<\/span>\/usr\/local\/bin\/pcre2-config\r\n<span class=\"nt\">--enable-mods-shared<\/span><span class=\"o\">=<\/span>reallyall <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-ssl<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--with-ssl<\/span><span class=\"o\">=<\/span>\/usr\/local\/ssl <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-proxy<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-proxy-ajp<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-dav<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-dav-fs<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-headers<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-rewrite<\/span><span class=\"o\">=<\/span>shared <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-deflate<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--with-pcre<\/span><span class=\"o\">=<\/span>\/usr\/local <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--enable-systemd<\/span>\r\nmake <span class=\"nt\">-j<\/span> 4\r\nmake <span class=\"nb\">install<\/span>\r\n<\/code><\/pre>\n<h3>\u8bf7\u62ff\u67658.mod_systemd.c<\/h3>\n<p>\u5728\u7f16\u8bd1\u4e4b\u524d\uff0c\u8bf7\u5148\u786e\u8ba4\u662f\u5426\u9884\u5148\u5b89\u88c5\u4e86 &#8220;systemd-devel-219-62.el7.x86_64.rpm&#8221;\u3002\uff08\u5982\u679c\u6ca1\u6709\u5b89\u88c5\u8be5\u8f6f\u4ef6\u5305\uff0c\u5c06\u5bfc\u81f4\u7f16\u8bd1\u5931\u8d25\uff0c\u63d0\u793a\u7f3a\u5c11 sd-daemon.h \u6587\u4ef6\uff09<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">cd<\/span> \/usr\/local\/src\/httpd-2.4.57\/modules\/arch\/unix\r\n<span class=\"c\">#wget https:\/\/raw.githubusercontent.com\/apache\/httpd\/trunk\/modules\/arch\/unix\/mod_systemd.c<\/span>\r\n\r\n<span class=\"c\">#aspx\u3092\u4f7f\u3063\u3066\u30b3\u30f3\u30d1\u30a4\u30eb<\/span>\r\n\/usr\/local\/apache2\/bin\/apxs <span class=\"nt\">-c<\/span> mod_systemd.c <span class=\"nt\">-I<\/span> \/usr\/include\/systemd\/sd-daemon.h\r\n\r\n<span class=\"c\">#libtool\u306b\u304a\u307e\u3058\u306a\u3044<\/span>\r\n<span class=\"c\">#CentOS7\u79fb\u884c or Ubunt\u3067\u306f\u4ee5\u4e0b\u3092\u5b9f\u884c<\/span>\r\nlibtool <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--silent<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--mode<\/span><span class=\"o\">=<\/span>compile gcc <span class=\"nt\">-std<\/span><span class=\"o\">=<\/span>gnu99 <span class=\"nt\">-prefer-pic<\/span> <span class=\"nt\">-O2<\/span> <span class=\"nt\">-g<\/span> <span class=\"nt\">-pipe<\/span> <span class=\"nt\">-Wall<\/span> <span class=\"nt\">-Wp<\/span>,-D_FORTIFY_SOURCE<span class=\"o\">=<\/span>2 <span class=\"nt\">-fexceptions<\/span> <span class=\"nt\">-fstack-protector-strong<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--param<\/span><span class=\"o\">=<\/span>ssp-buffer-size<span class=\"o\">=<\/span>4 <span class=\"nt\">-grecord-gcc-switches<\/span> <span class=\"nt\">-m64<\/span> <span class=\"nt\">-mtune<\/span><span class=\"o\">=<\/span>generic <span class=\"nt\">-D_LARGEFILE64_SOURCE<\/span>  <span class=\"nt\">-DLINUX<\/span> <span class=\"nt\">-D_REENTRANT<\/span> <span class=\"nt\">-D_GNU_SOURCE<\/span> <span class=\"nt\">-pthread<\/span> <span class=\"nt\">-I<\/span>\/usr\/local\/apache2\/include  <span class=\"nt\">-I<\/span>\/usr\/local\/apache2\/include   <span class=\"nt\">-I<\/span>\/usr\/local\/apache2\/include <span class=\"nt\">-I<\/span>\/usr\/local\/apr\/include\/apr-1  <span class=\"nt\">-c<\/span> <span class=\"nt\">-o<\/span> mod_systemd.lo mod_systemd.c <span class=\"o\">&amp;&amp;<\/span> <span class=\"nb\">touch <\/span>mod_systemd.slo\r\n\r\nlibtool <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--silent<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--mode<\/span><span class=\"o\">=<\/span><span class=\"nb\">link <\/span>gcc <span class=\"nt\">-std<\/span><span class=\"o\">=<\/span>gnu99 <span class=\"nt\">-Wl<\/span>,-z,relro,-z,now,-L\/usr\/lib64   <span class=\"nt\">-o<\/span> mod_systemd.la  <span class=\"nt\">-rpath<\/span> \/usr\/local\/apache2\/modules <span class=\"nt\">-module<\/span> <span class=\"nt\">-avoid-version<\/span>    mod_systemd.lo\r\n\r\n\r\nlibtool <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--silent<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--mode<\/span><span class=\"o\">=<\/span><span class=\"nb\">link <\/span>gcc <span class=\"nt\">-std<\/span><span class=\"o\">=<\/span>gnu99 <span class=\"nt\">-Wl<\/span>,-z,relro,-z,now,-L\/usr\/lib64   <span class=\"nt\">-o<\/span> mod_systemd.la  <span class=\"nt\">-rpath<\/span> \/usr\/local\/apache2\/modules <span class=\"nt\">-module<\/span> <span class=\"nt\">-avoid-version<\/span>    mod_systemd.lo <span class=\"nt\">-lsystemd-daemon<\/span>\r\n\r\n<span class=\"c\">#\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u767b\u9332<\/span>\r\n\/usr\/local\/apache2\/bin\/apxs <span class=\"nt\">-i<\/span> <span class=\"nt\">-a<\/span> <span class=\"nt\">-n<\/span> systemd mod_systemd.la\r\n\r\n\r\n<span class=\"c\">#ubunti\u306f\u3001libtool\u3092\u5165\u308c\u308b<\/span>\r\napt <span class=\"nb\">install <\/span>libtool-bin\r\n\r\n<span class=\"c\">#CentOS8\u3067\u306f\u4ee5\u4e0b\u3092\u5b9f\u884c<\/span>\r\n<span class=\"nb\">cd<\/span> \/usr\/local\/src\/httpd-2.4.57\/modules\/arch\/unix\r\ndnf <span class=\"nb\">install <\/span>systemd-devel\r\n\r\nlibtool <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--silent<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--mode<\/span><span class=\"o\">=<\/span>compile gcc <span class=\"nt\">-std<\/span><span class=\"o\">=<\/span>gnu99 <span class=\"nt\">-prefer-pic<\/span> <span class=\"nt\">-O2<\/span> <span class=\"nt\">-g<\/span> <span class=\"nt\">-pipe<\/span> <span class=\"nt\">-Wall<\/span> <span class=\"nt\">-Wp<\/span>,-D_FORTIFY_SOURCE<span class=\"o\">=<\/span>2 <span class=\"nt\">-fexceptions<\/span> <span class=\"nt\">-fstack-protector-strong<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--param<\/span><span class=\"o\">=<\/span>ssp-buffer-size<span class=\"o\">=<\/span>4 <span class=\"nt\">-grecord-gcc-switches<\/span> <span class=\"nt\">-m64<\/span> <span class=\"nt\">-mtune<\/span><span class=\"o\">=<\/span>generic <span class=\"nt\">-D_LARGEFILE64_SOURCE<\/span>  <span class=\"nt\">-DLINUX<\/span> <span class=\"nt\">-D_REENTRANT<\/span> <span class=\"nt\">-D_GNU_SOURCE<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">-pthread<\/span> <span class=\"nt\">-I<\/span>\/usr\/local\/apache2\/include <span class=\"nt\">-I<\/span>\/usr\/local\/apr\/include\/apr-1 <span class=\"nt\">-c<\/span> <span class=\"nt\">-o<\/span> mod_systemd.lo mod_systemd.c <span class=\"o\">&amp;&amp;<\/span> <span class=\"nb\">touch <\/span>mod_systemd.slo\r\nlibtool <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--silent<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--mode<\/span><span class=\"o\">=<\/span><span class=\"nb\">link <\/span>gcc <span class=\"nt\">-std<\/span><span class=\"o\">=<\/span>gnu99 <span class=\"nt\">-Wl<\/span>,-z,relro,-z,now,-L\/usr\/lib64 <span class=\"nt\">-o<\/span> mod_systemd.la <span class=\"nt\">-rpath<\/span> \/usr\/local\/apache2\/modules <span class=\"nt\">-module<\/span> <span class=\"nt\">-avoid-version<\/span> mod_systemd.lo\r\nlibtool <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--silent<\/span> <span class=\"se\">\\<\/span>\r\n<span class=\"nt\">--mode<\/span><span class=\"o\">=<\/span><span class=\"nb\">link <\/span>gcc <span class=\"nt\">-std<\/span><span class=\"o\">=<\/span>gnu99 <span class=\"nt\">-Wl<\/span>,-z,relro,-z,now,-L\/usr\/lib64 <span class=\"nt\">-o<\/span> mod_systemd.la <span class=\"nt\">-rpath<\/span> \/usr\/local\/apache2\/modules <span class=\"nt\">-module<\/span> <span class=\"nt\">-avoid-version<\/span> mod_systemd.lo <span class=\"nt\">-lsystemd<\/span>\r\n\/usr\/local\/apache2\/bin\/apxs <span class=\"nt\">-i<\/span> <span class=\"nt\">-a<\/span> <span class=\"nt\">-n<\/span> systemd mod_systemd.la\r\n\r\n\r\n<\/code><\/pre>\n<h3>9. \u51c6\u5907\u542f\u52a8\u811a\u672c<\/h3>\n<pre class=\"post-pre\"><code><span class=\"nb\">cat<\/span> <span class=\"o\">&gt;<\/span> \/usr\/lib\/systemd\/system\/httpd.service <span class=\"o\">&lt;&lt;<\/span> <span class=\"no\">EOF<\/span><span class=\"sh\">\r\n[Unit]\r\nDescription=The Apache HTTP Server\r\nAfter=network.target remote-fs.target nss-lookup.target\r\nDocumentation=man:httpd(8)\r\nDocumentation=man:apachectl(8)\r\n\r\n[Service]\r\nType=notify\r\n#EnvironmentFile=\/usr\/local\/apache2\/conf\/httpd.conf\r\nEnvironment=LD_LIBRARY_PATH=\/usr\/local\/ssl\/lib:\/usr\/local\/lib:\/usr\/local\/lib64:\/usr\/lib\r\nExecStart=\/usr\/local\/apache2\/bin\/httpd <\/span><span class=\"se\">\\$<\/span><span class=\"sh\">OPTIONS -DFOREGROUND\r\nExecReload=\/usr\/local\/bin\/httpd <\/span><span class=\"se\">\\$<\/span><span class=\"sh\">OPTIONS -k graceful\r\nExecStop=\/bin\/kill -WINCH <\/span><span class=\"se\">\\$<\/span><span class=\"sh\">{MAINPID}\r\n# We want systemd to give httpd some time to finish gracefully, but still want\r\n# it to kill httpd after TimeoutStopSec if something went wrong during the\r\n# graceful stop. Normally, Systemd sends SIGTERM signal right after the\r\n# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give\r\n# httpd time to finish.\r\nKillSignal=SIGCONT\r\nPrivateTmp=true\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/span><span class=\"no\">\r\nEOF\r\n<\/span><\/code><\/pre>\n<h3>10. \u6700\u540e\uff0c\u5728\u6ce8\u518c\u542f\u52a8\u548c\u81ea\u52a8\u542f\u52a8\u65f6\u5b8c\u6210\u64cd\u4f5c\u3002<\/h3>\n<pre class=\"post-pre\"><code>systemctl daemon-reload\r\nsystemctl start httpd\r\nsystemctl <span class=\"nb\">enable <\/span>httpd\r\n<\/code><\/pre>\n<h2>\u8bf7\u5728\u6bcd\u8bed\u4e2d\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6539\u8ff0\u4e3a\u4e2d\u6587\uff0c\u53ea\u9700\u4e00\u4e2a\u9009\u9879\uff1a<\/h2>\n<p>\u53c2\u8003\u8d44\u6599<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">http:\/\/unix.stackexchange.com\/questions\/262051\/help-to-install-apache-module-mod-systemd<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">http:\/\/kazmax.zpp.jp\/apache\/apache3.html<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">http:\/\/linux.systemv.pe.kr\/apache-source-install\/<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u4e16\u754c\u4e0a\u6700\u5e38\u7528\u7684Web\u670d\u52a1\u5668\u662fApache http server\u3002\u7531\u4e8eCentOS7\u53d8\u4e3asystemd\uff0c\u4ece\u6e90\u4ee3 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-36960","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728rocky-linux-9-x-ubuntu-22-04-x\u4e0a\u5b89\u88c5apache-2-4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09\" \/>\n<meta property=\"og:description\" content=\"\u4e16\u754c\u4e0a\u6700\u5e38\u7528\u7684Web\u670d\u52a1\u5668\u662fApache http server\u3002\u7531\u4e8eCentOS7\u53d8\u4e3asystemd\uff0c\u4ece\u6e90\u4ee3 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728rocky-linux-9-x-ubuntu-22-04-x\u4e0a\u5b89\u88c5apache-2-4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-11T13:12:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T02:43:59+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/\",\"name\":\"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-11-11T13:12:40+00:00\",\"dateModified\":\"2024-04-29T02:43:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728rocky-linux-9-x-ubuntu-22-04-x\u4e0a\u5b89\u88c5apache-2-4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09","og_description":"\u4e16\u754c\u4e0a\u6700\u5e38\u7528\u7684Web\u670d\u52a1\u5668\u662fApache http server\u3002\u7531\u4e8eCentOS7\u53d8\u4e3asystemd\uff0c\u4ece\u6e90\u4ee3 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728rocky-linux-9-x-ubuntu-22-04-x\u4e0a\u5b89\u88c5apache-2-4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-11-11T13:12:40+00:00","article_modified_time":"2024-04-29T02:43:59+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/","name":"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-11-11T13:12:40+00:00","dateModified":"2024-04-29T02:43:59+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5728Rocky Linux 9.x \/ Ubuntu 22.04.x\u4e0a\u5b89\u88c5Apache 2.4\uff08\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1\uff09\uff08\u652f\u6301systemd\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8rocky-linux-9-x-ubuntu-22-04-x%e4%b8%8a%e5%ae%89%e8%a3%85apache-2-4%ef%bc%88%e4%bb%8e%e6%ba%90%e4%bb%a3%e7%a0%81%e7%bc%96%e8%af%91%ef%bc%89%ef%bc%88%e6%94%af%e6%8c%81systemd%ef%bc%89\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/36960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=36960"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/36960\/revisions"}],"predecessor-version":[{"id":84798,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/36960\/revisions\/84798"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=36960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=36960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=36960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}