我从源代码构建了apache-httpd-2.4.20
并正确安装。
我在apphttpd.service
下创建了/etc/systemd/system
。
脚本
[Unit]
Description=Apache Web Server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
TimeoutStartSec=600
PIDFile=/usr/local/apache/logs/httpd.pid
ExecStart=/usr/local/apache/bin/apachectl -k start
ExecStop=/usr/local/apache/bin/apachectl -k stop
ExecReload=/usr/local/apache/bin/apachectl -k graceful
Restart=on-abort
PrivateTmp=true
LimitNOFILE=infinity
#User=root
#Group=root
[Install]
WantedBy=multi-user.target
当我执行systemctl start apphttpd
时,得到消息已启动Apache Web Server,
状态记录
**systemctl status -l apphttpd**
apphttpd.service - Apache Web Server
Loaded: loaded (/etc/systemd/system/apphttpd.service; enabled)
Active: inactive (dead) since Wed 2018-06-13 21:45:20 SGT; 14min ago
Process: 112124 ExecStop=/usr/local/apache/bin/apachectl -k stop (code=exited, status=0/SUCCESS)
Process: 112118 ExecStart=/usr/local/apache/bin/apachectl -k start (code=exited, status=0/SUCCESS)
Main PID: 112118 (code=exited, status=0/SUCCESS)
Jun 13 21:45:20 <host> systemd[1]: Started Apache Web Server.
但实际上没有启动服务。
error_log信息:
[Wed Jun 13 21:45:20.873135 2018] [core:debug] [pid 112123:tid 139709837686656] log.c(1546): AH02639: Using SO_REUSEPORT: yes (1)
[Wed Jun 13 21:45:20.873145 2018] [mpm_worker:debug] [pid 112123:tid 139709837686656] worker.c(1874): AH00294: Accept mutex: sysvsem (default: sysvsem)
[Wed Jun 13 21:45:20.907675 2018] [core:info] [pid 112123:tid 139709837686656] AH00096: removed PID file /usr/local/apache/logs/httpd.pid (pid=112123)
[Wed Jun 13 21:45:20.907684 2018] [mpm_worker:notice] [pid 112123:tid 139709837686656] AH00295: caught SIGTERM, shutting down
但是如果我从/ usr / local / apache / bin / apachectl -k start启动服务,服务就会正常启动并能够得到响应。
[Wed Jun 13 21:46:25.146698 2018] [core:debug] [pid 112229:tid 140320724187008] log.c(1546): AH02639: Using SO_REUSEPORT: yes (1)
[Wed Jun 13 21:46:25.146711 2018] [mpm_worker:debug] [pid 112229:tid 140320724187008] worker.c(1874): AH00294: Accept mutex: sysvsem (default: sysvsem)
我的apphttpd.service脚本是否存在任何问题,是否存在任何访问问题?提前感谢您的建议和帮助。