把编译安装的httpd 实现服务脚本,通过service和chkconfig 进行管理

1 编译安装httpd

把httpd编译安装在/app/httpd/目录下。

2 在/etc/rc.d/init.d/目录下新建一个文件httpd

这个文件的目的在于让service 命令可以管理编译安装的httpd服务。

文件内容如下:

[root@CentOS68 ~]# cat /etc/rc.d/init.d/httpd

#!/bin/bash
#
# httpd Start up the httpd server daemon
#
# chkconfig: 2345 99 01
# description: httpd is a protocol for web server.
# This service starts up the httpd server daemon.
#
# processname: httpd
case $1 in
start)
/app/httpd/bin/apachectl start ;;
stop)
/app/httpd/bin/apachectl stop ;;
status)
/app/httpd/bin/apachectl status ;;
*)
echo err
esac

3 添加为开机启动

[root@CentOS68 /app/httpd/bin]# chkconfig --add httpd
[root@CentOS68 /app/httpd/bin]# chkconfig --list |grep httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

可以看到已经添加成功

4 通过service 命令启动服务

[root@CentOS68 ~]# service httpd start
httpd: Could not reliably determine the server's fully qualified domain name, using CentOS68.localhost for ServerName

可以看到会报错,但是服务已经启动成功了,修改/app/httpd/conf/httpd.conf这个文件,把98行前面的#去掉即可

98 #ServerName www.example.com:80

现在可以通过service命令管理手动安装的httpd 服务了

最新文章

  1. 沃罗诺伊图(Voronoi Diagram,也称作Dirichlet tessellation,狄利克雷镶嵌)
  2. ✡ leetcode 163. Missing Ranges 找出缺失范围 --------- java
  3. VS2010 项目引用了DLL文件,也写了Using,但是编译时提示:未能找到类型或命名空间名称 <转>
  4. HTML5格式化
  5. Python核心编程笔记----注释
  6. P2P系统,一致性哈希和DHT
  7. Python_跟随目标主机IP变换
  8. 末学者笔记--shell编程上 2 玄
  9. Application Security Per-Engagement
  10. 仿QQ菜单栏:消息,电话菜单
  11. 永久关闭selinux
  12. Code Review(转)
  13. RabbitMQ生产者消费者
  14. 广播小案例-监听系统网络状态 --Android开发
  15. java中 this 关键字的三种用法
  16. WebDriver高级应用实例(7)
  17. Visual Studio 2010详细安装过程
  18. 项目冲刺Second
  19. 每日英语:How Pop Culture Influences Chinese Travelers
  20. 【转】HTML <!--...--> 注释 、CSS/JS //注释 和 /*.....*/ 注释

热门文章

  1. GWAS: 网页版的基因型填充(genotype imputation)
  2. spring 使用@AspectJ注解开发Spring AOP
  3. 如何发布自定义的UI 组件库到 npmjs.com 并且编写 UI组件说明文档
  4. C# 获取或设置指定 config 文件的值
  5. SQL Server数据同步到Oracle
  6. 【Tools】PDF编辑软件-pdfelement 6.8 官网文件中文+破解版本
  7. k8s SLUB: Unable to allocate memory on node -1 错误
  8. 记录一下vue slot
  9. extract()函数:用于从一个date或者interval类型中截取到特定的部分
  10. Appium移动自动化测试-----(五)python-client安装与测试