Compile and install httpd to implement service scripts, and manage them through service and chkconfig. httpdchkconfig

Source: Internet
Author: User
Tags fully qualified domain name

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.