免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3237 | 回复: 8
打印 上一主题 下一主题

apache 问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-11 01:29 |只看该作者 |倒序浏览
问大家一个简单而又费了我很多时间的问题哦,源码安装apache,要用service启动,是把哪个文件CP到什么目录下呢?还要哪里修改设置吗?网上答案五花八门的,试了,都没成功。

论坛徽章:
7
天蝎座
日期:2013-08-16 23:19:32丑牛
日期:2014-01-08 09:20:14寅虎
日期:2014-01-11 11:03:44午马
日期:2014-04-28 11:02:40天秤座
日期:2014-05-16 23:24:24摩羯座
日期:2014-07-20 10:46:04卯兔
日期:2014-08-08 15:21:41
2 [报告]
发表于 2009-08-11 12:01 |只看该作者
1:
cp /usr/local/apache2/bin/apachectl  /etc/rc.d/init.d/httpd       ////// 拷贝
2:
vi  /etc/rc.d/init.d/httpd
#!/bin/sh
#chkconfig:2345 10 90                                                         //////添加
#description:Activates/Deactivates Aapache Web Server   //////添加

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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 during a restart
#       6 - httpd could not be restarted during a restart
#       7 - httpd could not be restarted during 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/apache2/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/apache2/bin/envvars; then
  . /usr/local/apache2/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="links -dump"
#
# 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|graceful-stop)
    $HTTPD -k $ARGV
    ERROR=$?
    ;;
startssl|sslstart|start-SSL)
    echo The startssl option is no longer supported.
    echo Please edit httpd.conf to include the SSL configuration settings
    echo and then use "apachectl start".
    ERROR=2
    ;;
configtest)
  $HTTPD -t
    ERROR=$?
    ;;
status)
    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
    ;;
fullstatus)
    $LYNX $STATUSURL
    ;;
*)
    $HTTPD $ARGV
    ERROR=$?
esac

exit $ERROR
3:
root@server /]# chkconfig --add httpd
[root@server /]# chkconfig --level 2345 httpd on
4:
[root@server /]# service httpd restart
[root@server /]# service httpd start
httpd (pid 3404) already running
5:
完毕

论坛徽章:
0
3 [报告]
发表于 2009-08-12 01:01 |只看该作者

回复 #2 www_xylove 的帖子

#chkconfig:2345 10 90                                                         //////添加
#description:Activates/Deactivates Aapache Web Server   //////添加
前面有#号不是注释掉了吗?不是不起作用了吗?

论坛徽章:
0
4 [报告]
发表于 2009-08-12 01:30 |只看该作者

回复 #2 www_xylove 的帖子

您好,我已按照你的步骤操作,然后我执行以下命令
[root@giqing ~]# service httpd restart  \\\\rpm安装的,执行这条命令后都有关闭确定,启动确定这样的显示,为什么这个没有呢?
[root@giqing ~]# service httpd start \\\\\同上
httpd (pid 1341 already running
[root@giqing ~]# service httpd stop \\\\这个也应该有提示的吧?
[root@giqing ~]# service httpd status
ELinks: 拒绝连接        \\\\怎么会有这个显示呢?
[root@giqing ~]#
[root@giqing ~]#

论坛徽章:
7
天蝎座
日期:2013-08-16 23:19:32丑牛
日期:2014-01-08 09:20:14寅虎
日期:2014-01-11 11:03:44午马
日期:2014-04-28 11:02:40天秤座
日期:2014-05-16 23:24:24摩羯座
日期:2014-07-20 10:46:04卯兔
日期:2014-08-08 15:21:41
5 [报告]
发表于 2009-08-12 03:42 |只看该作者
原帖由 giqing 于 2009-8-12 01:30 发表
您好,我已按照你的步骤操作,然后我执行以下命令
[root@giqing ~]# service httpd restart  \\\\rpm安装的,执行这条命令后都有关闭确定,启动确定这样的显示,为什么这个没有呢?
[root@giqing ~]# service ...

直接 service httpd restart
或service httpd start

不要去看‘#’这个。
把rpm包的apache删除。

[ 本帖最后由 www_xylove 于 2009-8-12 03:44 编辑 ]

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
6 [报告]
发表于 2009-08-12 22:45 |只看该作者
先删除原来的rpm包

论坛徽章:
0
7 [报告]
发表于 2009-08-13 17:27 |只看该作者
我之前没有安装rpm包,是不是源码安装的执行命令后没有提示的啊?

论坛徽章:
0
8 [报告]
发表于 2009-08-13 21:17 |只看该作者
把bin下的apachectl  拷贝到init.d

论坛徽章:
0
9 [报告]
发表于 2009-08-14 11:31 |只看该作者
学习了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP