Compile and install httpd to implement service scripts, and manage them through service and chkconfig. httpdchkconfig
Compile and install httpd to implement service scripts and manage them through service and chkconfig.
1. Compile and install httpd
Compile and install httpd in the/app/httpd/directory.
2. Create an httpd file in the/etc/rc. d/init. d/directory.
The purpose of this file is to allow the service command to manage the httpd service compiled and installed.
The file content is as follows:
[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: httpdcase $1 instart) /app/httpd/bin/apachectl start ;;stop) /app/httpd/bin/apachectl stop ;;status) /app/httpd/bin/apachectl status ;;*) echo erresac
3 add as boot
[root@CentOS68 /app/httpd/bin]# chkconfig --add httpd[root@CentOS68 /app/httpd/bin]# chkconfig --list |grep httpdhttpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
You can see that it has been added successfully.
4. Run the service command to start the service.
[root@CentOS68 ~]# service httpd starthttpd: Could not reliably determine the server's fully qualified domain name, using CentOS68.localhost for ServerName
As you can see, an error is reported, but the service has been started successfully. Modify the/app/httpd/conf/httpd. conf file and remove the # Before the 98 line.
98 # ServerName www.example.com: 80
Now you can use the service command to manage the httpd service that is manually installed.