为了确保我可以完全控制用于生产目的的 Apache httpd 配置,我正在 CentOS 7 上从源代码构建 httpd。
配置、制作和安装工作正常。我正在使用:
./configure --with-mpm=prefork --with-mysql --prefix=/usr/local/apache2 --enable-so --enable-ssl --enable-rewrite
使用 apachectl 构建的 Web 服务器可以正常工作,但是 CentOS 7 使用 systemd 而不是 upstart,所以使用 systemctl 需要我有一个
httpd.service
内置并安装到 /lib/systemd/system
我如何构建它?
最佳答案
这就是我所做的,我创建了文件/etc/systemd/system/apache.service
(假设您的 apachectl 位于/usr/apache/bin)如下:
[Unit]
Description=The Apache HTTP Server
[Service]
Type=forking
EnvironmentFile=/usr/apache/bin/envvars
PIDFile=/var/apache/httpd.pid
ExecStart=/usr/apache/bin/apachectl start
ExecReload=/usr/apache/bin/apachectl graceful
ExecStop=/usr/apache/bin/apachectl stop
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi-user.target
然后运行 systemctl enable apache
关于apache - 如何使用 systemd 支持编译 Apache httpd 2.4.16?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32977557/