CentOS 6 中,服务器的启动脚本存放于/etc/init.d/httpd。当然我们自己编写服务的启动脚本有些困难,我们可以参考以前安装过的服务脚本略加修改。
将这个文件/etc/init.d/httpd 改名为/etc/init.d/httpd24,然后修改如下内容
将服务添加到开机启动,并开启服务 # 将服务添加到服务列表 [root@localhost init.d]# chkconfig --add httpd24 # 将服务设置为开机启动 [root@localhost init.d]# chkconfig httpd24 on # 启动服务 [root@localhost init.d]# service httpd24 start在启动服务的过程中有可能会提示以下错误 ,这是提示没有创建网站的根目录。所以我们去创建一下。
[root@localhost init.d]# service httpd24 start Starting httpd: AH00526: Syntax error on line 225 of /app/httpd24/conf/httpd.conf: DocumentRoot '/app/website' is not a directory, or is not readable [FAILED] 创建网站主页,并进行测试 # 创建网站的根目录 [root@localhost init.d]# mkdir /app/website # 建立网站主页,用于测试路径 [root@localhost init.d]# echo /app/website/index.html > /app/website/index.html经过上述步骤,基本上就能够在CentOS 6 上成功的安装和运行HTTP 2.4了,如果还有什么疑问,可以留言一起套路。