Optimize execution path
ln -s /usr/local/httpd/conf/httpd.conf /etc/
ln -s /usr/local/httpd/bin/* /usr/local/bin/
httpd -v ###查当前HTTP版本
Create [service].service configuration file to add system to service
In the /lib/systemd/system/ directory, create a unit configuration file ending with .service
to control the httpd service managed or monitored by systemd
[root@localhost ~]# cd /lib/systemd/system/
[root@localhost system]# vim httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/httpd/logs/httpd.pid
ExecStart= /usr/local/bin/apachectl $OPTIONS
ExecrReload= /bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl start httpd ###检查HTTP单元是否启动
[root@localhost system]# systemctl enable httpd ###开机自启http
[root@localhost httpd-2.4.29]# systemctl restart httpd ###重启http