本文共 8462 字,大约阅读时间需要 28 分钟。
下文是我边试边做的记录,不保证内容的完整性和正确性。
由于我的Apsire机器是最简安装Foreda8,所以需要安装httpd,熟悉一遍也是很好的嘛。
我从网上搜罗并下载了apchehttpd-2.4.6.tar.gz以及安装httpd需要的包apr-1.4.6.tar.gz,apr-util-1.5.1.tar.gz。
安装apr-1.4.6基本是解压,make,make install;安装过程中提示gcc没安,于是用yum install gcc*安上了。
安装apr-util-1.5.1也是一样的解压,make,make install;
Apchehttpd-2.4.6.tar.gz是解压,./configure,make,make install.
安装后httpd被放到了usr/local/apache2下。
之后将usr/local/apache2/conf/httpd.conf 拷贝到/usr/local/httpd/conf/下,之前需要创建目录http和子目录conf。
然后进入usr/local/apache2/bin,用命令 ./apachectl start 启动httpd。下图就是浏览器看到的启动结果。
但是,使用service httpd start/stop ,系统不识别,说httpd: unrecognized service。
So,又去请教百度大神,大神保佑这次没花多少时间,具体操作如下:
把apachectl拷贝到/etc/rc.d/init.d/下,名为httpd
[root@bogon init.d]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
加权限
[root@bogon init.d]# chmod 700 /etc/rc.d/init.d/httpd看一下
[root@bogon init.d]# ls
acpid dund killall nfslock rsyslog anacron firstboot kudzu nscd saslauthd atd functions lm_sensors ntpd sendmail auditd fuse mdmonitor openvpn setroubleshoot autofs gpm messagebus pand single avahi-daemon haldaemon microcode_ctl pcscd smartd bluetooth halt multipathd psacct smolt btseed httpd netconsole racoon sshd bttrack ip6tables netfs rdisc udev-post capi iptables netplugd restorecond winbind ConsoleKit irda network rpcbind wpa_supplicant cpuspeed irqbalance NetworkManager rpcgssd ypbind crond isdn NetworkManagerDispatcher rpcidmapd yum-updatesd cups jexec nfs rpcsvcgssd然后编辑httpd这个文件
[root@bogon init.d]# vi httpd下面是文件内容,下面第三行起的三行红字是新增加的,其它部分照旧。
#!/bin/sh
# ##Comments to support chkconfig on Redhat Linux#chkconfig:2345 90 90#description:http 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 # ACMD="$1" ARGV="$@".....
加完三行就行了,它的目的是在使用chkconfig时不会提示你这个错service httpd does not support chkconfig。
之后执行
[root@bogon init.d]# chkconfig --add httpd [root@bogon init.d]# chkconfig --level 2345 httpd on完成后就能用service httpd start/stop了
[root@bogon init.d]# service httpd start
AH00557: httpd: apr_sockaddr_info_get() failed for bogon AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message httpd (pid 2293) already running [root@bogon init.d]# service httpd stop AH00557: httpd: apr_sockaddr_info_get() failed for bogon AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message [root@bogon init.d]# service httpd start AH00557: httpd: apr_sockaddr_info_get() failed for bogon AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message [root@bogon init.d]#<全文完>
下文是我边试边做的记录,不保证内容的完整性和正确性。
由于我的Apsire机器是最简安装Foreda8,所以需要安装httpd,熟悉一遍也是很好的嘛。
我从网上搜罗并下载了apchehttpd-2.4.6.tar.gz以及安装httpd需要的包apr-1.4.6.tar.gz,apr-util-1.5.1.tar.gz。
安装apr-1.4.6基本是解压,make,make install;安装过程中提示gcc没安,于是用yum install gcc*安上了。
安装apr-util-1.5.1也是一样的解压,make,make install;
Apchehttpd-2.4.6.tar.gz是解压,./configure,make,make install.
安装后httpd被放到了usr/local/apache2下。
之后将usr/local/apache2/conf/httpd.conf 拷贝到/usr/local/httpd/conf/下,之前需要创建目录http和子目录conf。
然后进入usr/local/apache2/bin,用命令 ./apachectl start 启动httpd。下图就是浏览器看到的启动结果。
但是,使用service httpd start/stop ,系统不识别,说httpd: unrecognized service。
So,又去请教百度大神,大神保佑这次没花多少时间,具体操作如下:
把apachectl拷贝到/etc/rc.d/init.d/下,名为httpd
[root@bogon init.d]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
加权限
[root@bogon init.d]# chmod 700 /etc/rc.d/init.d/httpd看一下
[root@bogon init.d]# ls
acpid dund killall nfslock rsyslog anacron firstboot kudzu nscd saslauthd atd functions lm_sensors ntpd sendmail auditd fuse mdmonitor openvpn setroubleshoot autofs gpm messagebus pand single avahi-daemon haldaemon microcode_ctl pcscd smartd bluetooth halt multipathd psacct smolt btseed httpd netconsole racoon sshd bttrack ip6tables netfs rdisc udev-post capi iptables netplugd restorecond winbind ConsoleKit irda network rpcbind wpa_supplicant cpuspeed irqbalance NetworkManager rpcgssd ypbind crond isdn NetworkManagerDispatcher rpcidmapd yum-updatesd cups jexec nfs rpcsvcgssd然后编辑httpd这个文件
[root@bogon init.d]# vi httpd下面是文件内容,下面第三行起的三行红字是新增加的,其它部分照旧。
#!/bin/sh
# ##Comments to support chkconfig on Redhat Linux#chkconfig:2345 90 90#description:http 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 # ACMD="$1" ARGV="$@".....
加完三行就行了,它的目的是在使用chkconfig时不会提示你这个错service httpd does not support chkconfig。
之后执行
[root@bogon init.d]# chkconfig --add httpd [root@bogon init.d]# chkconfig --level 2345 httpd on完成后就能用service httpd start/stop了
[root@bogon init.d]# service httpd start
AH00557: httpd: apr_sockaddr_info_get() failed for bogon AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message httpd (pid 2293) already running [root@bogon init.d]# service httpd stop AH00557: httpd: apr_sockaddr_info_get() failed for bogon AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message [root@bogon init.d]# service httpd start AH00557: httpd: apr_sockaddr_info_get() failed for bogon AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message [root@bogon init.d]#<全文完>
本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/xiandedanteng/p/3289565.html,如需转载请自行联系原作者