Apache 配置 限制

2016-01-29 18:24 1 1 收藏

Apache 配置 限制,Apache 配置 限制

【 tulaoshi.com - Linux 】

Apache 安装、配置使用 mod_limitipconn.c 来限制 apache 的并发数 >> 定制 Apache index 目录 >> 让apache上的图片有防止盗链的功能 >>
Apache 安装、配置使用 mod_limitipconn.c 来限制 apache 的并发数 >> 定制 Apache index 目录 >> 让apache上的图片有防止盗链的功能 >> 安装 Apache 2.0.48 (查看Install手册) 考虑到以后要 rewite_url 来使 google 更加容易收录网站,特地添加了 mod_rewrite 。 同时为了限制流量,特别加了 mod_limitpcnn.c 补丁 , 所以多了一个 --enable-forward 选项。 建议安装完毕以后不要删除安装目录,以便以后升级时使用。 记得升级前关闭 apache2.0 编译过程:#./configure --enable-so --enable-speling --enable-rewrite --with-ssl=/usr/local/ssl --enable-forward # make # make install 这个例子里面是编译了 mod_so,mod_speling 和 openssl 支持。同样有另外几种写法:#./configure --enable-so --enable-speling --enable-rewrite --with-ssl=/usr/local/ssl --enable-forward # make # make install 或者#./configure --enable-modules=”so speling” --enable-MODULE[=shared] 编译并包含模块 MODULE. MODULE 是文档中去掉”_module ”的模块名。要将一个模块编译成为 DSO, 需要加 -shared 选项 , 即 --enable-mods-shared 。(查看 MODULE 手册)注意 :"如果希望核心能够装载 DSO,而不实际编译任何动态模块,则要明确指定 --enable-modules=so 或者 --enable-so" (查看 DSO 手册),所以前面的顺序不能交换顺序。 查看所有apache 的 configure 参数安装完毕后可以用以下命令来查看启动了那些模块 # apachectl -lCompiled in modules:core.cmod_access.cmod_auth.cmod_include.cmod_log_config.cmod_env.c mod_setenvif.cprefork.chttp_core.cmod_mime.cmod_status.cmod_autoindex.cmod_asis.cmod_cgi.cmod_negotiation.cmod_dir.c mod_imap.cmod_actions.cmod_speling.cmod_userdir.cmod_alias.cmod_rewrite.cmod_so.c 接着,将启动程序放入开机程序中去。 如果要启动 ssl 加密网页,则必须通过手动启动 apache2.0 (参见 ssl 部分) # echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local 参考: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. 在 profile 里面添加以上的语句来设置路径,使得在 bash 下更容易控制 apachectl, 省去了输入路径的麻烦。# vi /etc/profile PATH=" $PATH:usr/local/apache2/bin:” 配置 apache2.0 # vi /usr/local/apache2/conf/httpd.conf 配置文件请看文件 httpd.conf (设置文档目录为/home/dalouis/public_html) #chmod 755 - R /home/dalouis/ 设置目录的可读性为 drwxr-xr-x(755), 否则会出现 "Forbidden You don't have permission to access / on this server." 一些关于安全性的配置: 考虑到 cgi-bin 的安全性问题,我们暂时将 cgi-bin 去掉。将所有 httpd.conf 中的所有关于 cgi-bin 的行加上 "#". Xiyang 的配置 我用的: mod_limitipconn, mod_expires, mod_gzip, mod_php4, mod_so, mod_access, mod_alias, mod_userdir, mod_dir, mod_autoindex, mod_status, mod_mime, mod_log_config, http_core 关于超时的问题 在我编写好所有的产品查看页面的时候,经常会出现因为超时,或者流量过大 ,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这里的安装建议使

来源:https://www.tulaoshi.com/n/20160129/1505623.html

延伸阅读
A:假设你使用RPM正确安装了PHP,那你必须反注或加入下面的几行到httpd.conf文件中: #Extra Modules AddModule mod_php.c AddModule mod_php3.c AddModule mod_perlc. #Extra Modules LoadModule php_module modules/mod_php.so LoadModule php3_module modules/libphp3.so LoadModule perl...
标签: PHP
Apache服务器的设置文件位于/usr/local/apache/conf/目录下,传统上使用三个配置文件httpd.conf,access.conf和srm.conf,来配置Apache服务器的行为。  httpd.conf提供了最基本的服务器配置,是对守护程序httpd如何运行的技术描述;srm.conf是服务器的资源映射文件,告诉服务器各种文件的MIME类型,以及如何支持这些文...
标签: 服务器
让Apache支持SHTML(SSI)的配置方法 shtml和asp有一些相似,以shtml命名的文件里,使用了ssi的一些指令,就像asp中的指令,你可以在SHTML文件中写入SSI指令,当客户端访问这些shtml文件时,服务器端会把这些SHTML文件进行读取和解释,把SHTML文件中包含的SSI指令解释出来。 服务器采用shtml速度会比html慢,比php快。shtml的特点就是...
# 基于 NCSA 服务的配置文件。 # #这是Apache服务器主要配置文件。 #它包含服务器的影响服务器运行的配置指令。 #参见 以取得关于这些指令的详细信息 # #不要只是简单的阅读这些指令信息而不去理解它。 #这里只是做了简单的说明,如果你没有参考在线文件,你就会被警告。 # #这些配置指令被分为下面三个部分: #1. 控制整个Apache服务器行为的...
标签: PHP
Q:我使用RPM安装了PHP,但APACHE却不能处理PHP文件。为什么?   A:假设你使用RPM正确安装了PHP,那你必须反注或加入下面的几行到httpd.conf文件中: #Extra Modules AddModule mod_php.c AddModule mod_php3.c AddModule mod_perlc. #Extra Modules LoadModule php_module modules/mod_php.so LoadModule php3_m...

经验教程

797

收藏

52

精华推荐

Apache Web服务器.htaccess文件配置

Apache Web服务器.htaccess文件配置

中条山蜂蜜

android 横竖屏限制的配置方法

android 横竖屏限制的配置方法

半生不熟的男性

PHP+Apache在Win9X配置安装

PHP+Apache在Win9X配置安装

哎呀清河的

微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部