参考:
If you want your server to continue running after a system reboot , you should add a call to apachectl to your system startup files (typically rc.local or a file in an rc.N directory). This will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions.
关于超时的问题
在我编写好所有的产品查看页面的时候,经常会出现因为超时,或者流量过大 ,apache 停止工作的问题,原因有二,一是代码的不科学性,二是 apache 的设置问题。
以下是对设置的一点改动:
# KeepAlive: Whether or not to allow persistent connections(more than
# one request per connection). Set to "Off" to deactivate.
# KeepAlive Off
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
# MaxKeepAliveRequests 0
# KeepAliveTimeout: Number of seconds to wait for the next request
# from the same client on the same connection.
# KeepAliveTimeout 0
# 记录访问者的 HTTP-REFERER 和 AGENT, 有助于统计来者是通过什么搜索引擎找到我们的网站的。 或者在原有的CustomLog行,将参数由 common 改成 combined
# If you would like to have agent and referer logfiles,
# uncomment the following directives.
CustomLog logs/referer_log referer
CustomLog logs/agent_log agent
CustomLog logs/www.domain.com-access_log combined
使用 mod_limitipconn.c 来限制 apache 的并发数
Package: http://dominia.org/djao/limit/
安装使用说明: http://dominia.org/djao/limitipconn2-README
这里的安装建议使用动态 DSO 并 patch apache2.0, 以使得 apache2.0 可以认识在代理后方的 IP 。但是要 重新编译 apache2.0, 以下是介绍。
## Instructions for building DSO with proxy tracking:
# tar xzvf httpd-2.0.39.tar.gz
# tar xzvf mod_limitipconn-0.22.tar.gz
# cd httpd-2.0.39
# patch -p1
MaxConnPerIP 3
# exempting images from the connection limit is often a good
# idea if your web page has lots of inline images, since these
# pages often generate a flurry of concurrent image requests
# NoIPLimit image/*
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
# OnlyIPLimit audio/mpeg video
这使得 apache 不能识别原本设置的 README.html 和 HEADER.html,以下这点是从apache的文档中找到类似的解说.
参考
Filename must resolve to a document with a major content type of text/* ( e.g. , text/html , text/plain , etc.). This means that filename may refer to a CGI script if the script's actual file type (as opposed to its output) is marked as text/html such as with a directive like:
AddType text/html .cgi
Content negotiation will be performed if Options MultiViews is in effect. If filename resolves to a static text/html document (not a CGI script) and either one of the options Includes or IncludesNOEXEC is enabled, the file will be processed for server-side includes (see the mod_include documentation).