Latest Cenos Execution Service httpd Restart error failed to restart Httpd.service:Unit not found.

Source: Internet
Author: User

It turns out that Apache needs to be registered with the Linux service!
Registering Apache to Linux services
After installing Apache in source code mode under Linux, booting off Apache can be accomplished by the following command:

/usr/local/apache/bin/apachectl  start | stop | restart

If you want to include httpd in a system-initiated service, you can copy the above apachectl files directly into/ETC/RC.D/INIT.D, and then add the links to the appropriate boot level, such as 3,5. The command is as follows:

/usr/local/apache2/bin/apachectl  /etc/rc.d/init.d/httpd     # 复制到init.d 并重命名为httpdln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S61httpd

The S61 of the linked file is the ordinal at startup. When the INIT.D directory has a httpd script, we can start off Apache by using the service command. Execute under Any path:

stop | restart

Then there is a problem is: Although Apache can automatically start, but in the list of Linux services do not see it, to add services, generally through chkconfig--add xxx to achieve, but need to have the appropriate information in the script, otherwise chkconfig will prompt: XXX The service does not support Chkconfig. So we first edit the httpd script, and in line 2nd (#!/bin/sh below) Add the following comment information (including #):

# chkconfig: 35 61 61# description: Apache

The 3 parameters for the first line are: at which RunLevel, start httpd (3,5), start sequence number (S61), and close ordinal (K61). Note: The description of the second line must be written!
Save after execution:

chkconfig --add httpd                    #所有开机模式下自启动,另外chkconfig httpd on 表示345模式下自启动

The httpd is added to the service. S61HTTPD links will appear in the RC3.D, rc5.d path in the future, and k61httpd links will appear in other run-level paths.

Run the following command to view the service, and you will see the httpd service.
Chkconfig--list

Latest Cenos Execution Service httpd Restart error failed to restart Httpd.service:Unit not found.

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.