问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

linux开机后apache不能自动启动

发布网友 发布时间:2022-04-23 04:15

我来回答

4个回答

热心网友 时间:2023-10-14 11:56

开机启动的话可以配置/etc/rc.local文件,把启动apache服务的命令写到rc.local里,
比如echo
"/etc/init.d/httpd
start"
>>
/etc/rc.local
也可以把在对应的运行级别里创建apache服务启动脚本的链接。

热心网友 时间:2023-10-14 11:57

在/etc/init.d增加httpd
/etc/init.d# cat httpd
#!/bin/sh
#
# Copyright 2000-2005 The Apache Software Foundation or its licensors, as
# applicable.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache. Written by Marc Slemko, 1997/08/23
#
# The exit codes returned are:
# XXX this doc is no longer correct now that the interesting
# XXX functions are handled by httpd
# 0 - operation completed successfully
# 1 -
# 2 - usage error
# 3 - httpd could not be started
# 4 - httpd could not be stopped
# 5 - httpd could not be started ring a restart
# 6 - httpd could not be restarted ring a restart
# 7 - httpd could not be restarted ring a graceful restart
# 8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported. Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
# -------------------- --------------------
#
# the path to your httpd binary, including options if necessary
HTTPD='/usr/local/apache/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/apache/bin/envvars; then
. /usr/local/apache/bin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line. Designed for lynx, however other
# programs may work.
LYNX="lynx -mp"
#
# the URL to your server's mod_status status page. If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# -------------------- --------------------
# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||

# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
$ULIMIT_MAX_FILES
fi

ERROR=0
if [ "x$ARGV" = "x" ] ; then
ARGV="-h"
fi

case $ARGV in
start|stop|restart|graceful)
$HTTPD -k $ARGV
ERROR=$?
;;
startssl|sslstart|start-SSL)
$HTTPD -k start -DSSL
ERROR=$?
;;
configtest)
$HTTPD -t
ERROR=$?
;;
status)
$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
;;
fullstatus)
$LYNX $STATUSURL
;;
*)
$HTTPD $ARGV
ERROR=$?
esac

exit $ERROR
在你启动级别对应的rc?.d中加上链接
/etc/rc2.d# ls -l

lrwxrwxrwx 1 root root 17 2007-07-26 10:09 S98httpd -> /etc/init.d/httpd

就可以了

热心网友 时间:2023-10-14 11:57

chkconfig
--level
httpd
0123456
on
就可以
0123456是你的运行模式。

热心网友 时间:2023-10-14 11:58

很简单,让他开机启动
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
个人账户养老金预测公式:现有5万元,缴费20年,能领多少钱? 临沂比较有名的男装品牌 呼伦贝尔市悦动网络科技有限公司怎么样? 呼伦贝尔中汇实业有限公司怎么样? 呼伦贝尔油玉不绝电子商务有限公司怎么样? 如何避免wps卡顿? 属鼠的男人找对象是属什么,属鼠的人和什么属相合 96年鼠的姻缘在哪年 属相相合年份运势提升 2024属鼠找对象属什么最佳 黑客攻击网站能报案吗 兵马俑的所属省市份简称是什么 洋河股份是做什么的? 秦始皇兵马俑是在中国的哪个城市省份? 洋河酒厂好不好,待遇如何?求指点 谁了解洋河酒厂?尽可能详细的介绍一下,可以么? 洋河酒厂在什么省会什么市 为什么马天宇火不起来? 洋河酒厂属于泗阳吗? 马天宇曾为杨紫、林志玲、陈伟霆怼媒体,他为什么对大家这么好? 洋河小酒厂有哪些 马天宇为杨紫怼营销号,娱乐圈的真朋友应该是怎样的? 洋河酒厂一年交多少税 江苏洋河酒厂股份有限公司和江苏洋河集团有限公司的区别 马天宇的身世 洋河酒厂有哪几种酒 马天宇个人 身世是什么? 洋河酒厂是国营还是民营 马天宇唱《人间》为长春加油,这首歌中有哪些动人的力量? 中国洋河酒厂出过这种酒吗?2瓶装的42度,网上查不到。是真的吗? 马天宇为杨紫怼营销号,杨紫为何不发声? 您好,想请教下怎么在 linux(centos 7)中配置安装apache服务器 linux下apache服务启动不了的问题?? linux 怎么安装apache,mysql+php 脉脉里完善个人材料的教育经历会被其他人看见吗 苹果手机id已被锁定.验证不了身份怎么办 黄金瞳最新章节 黄金瞳最新章节列表 黄金瞳txt下载 求黄金瞳txt百度云。 黄金瞳txt下载精校版,无错字的 有谁有以 叶 或者 娴 字开头的昵称,结尾有这两个字也行 nba现在最强的中锋到底是谁 知否:长大后的蓉姐儿和娴姐儿,谁会成为第二个明兰? 想在脉脉上聊工作机会,担心是否会被现任单位发现? 苹果12与11pormks那个配置好? 怎样正确使用苹果Xsmks? 为什么我的苹果Xsmks在辅助里面找不到来电闪光灯? 苹果mks手机电打进打出都不得行怎么办? 苹果12mks抖音返回键不敏感怎么回事? 苹果XSMKS充电器插上上下左右可以动正常吗? 苹果xsmks.iD欠多少钱在哪里看? iPhone XS Max快速滑动淘宝时屏幕会突然闪一下,然后就没事了,这是怎么回事啊?