优化执行路径

优化执行路径

ln -s /usr/local/httpd/conf/httpd.conf /etc/
ln -s /usr/local/httpd/bin/* /usr/local/bin/
httpd -v      ###查当前HTTP版本

建立[service].service 配置文件添加系统给服务

在/lib/systemd/system/目录下,建立一个以.service 结尾的单元(unit)配置文件,
用于控制由 systemd 管理或监控的 httpd 服务

[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

猜你喜欢

转载自blog.csdn.net/weixin_48190875/article/details/108645013