Apache配置文件

Apache的配置文件默认路径是“/etc/httpd/conf/httpd.conf”,编辑该文件就可以修改Apache的配置

1、设置网页主目录,参数DocumentRoot就是网页存放的主目录。打开配置文件httpd.conf,查找DocumentRoot(大约292行)

[root@localhost ~]# gedit /etc/httpd/conf/httpd.conf

# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

DocumentRoot "/var/www/html"   //当前默认是在"/var/www/html"目录下,所有的网页必须放在这里

2、设置连接端口,通过参数listen来设置连接的端口,默认80.(大约136行)

[root@localhost ~]# gedit /etc/httpd/conf/httpd.conf

# Listen: Allows you to bind Apache to specific IP addresses and/or

# ports, in addition to the default. See also the <VirtualHost>

# directive.

#

# Change this to Listen on specific IP addresses as shown below to 

# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)

#

#Listen 12.34.56.78:80

Listen 80

3、设置连接超时,参数timeout,当连接超过一定的空闲时间,就会自动断开。(大约68行)

# Timeout: The number of seconds before receives and sends time out.

#

Timeout 60

4、设置字符集,参数AddDefaultCharset,建议最好设置utf-8,这是通用的。(大约753行)

# Specify a default charset for all content served; this enables

# interpretation of all content as UTF-8 by default.  To use the 

# default browser choice (ISO-8859-1), or to allow the META tags

# in HTML content to override this choice, comment out this

# directive:

#

AddDefaultCharset UTF-8

5、设置服务器名称,参数ServerName。这是服务器的域名,必须有dns解析才可以访问。如果你没有合法的域名,那么只能通过ip地址来访问

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

#

# If this is not set to valid DNS name for your host, server-generated

# redirections will not work.  See also the UseCanonicalName directive.

#

# If your host doesn't have a registered DNS name, enter its IP address here.

# You will have to access it by its address anyway, and this will make 

# redirections work in a sensible way.

#

#ServerName www.example.com:80

6、设置keepalive,提高网络效率,默认是关闭的。(大约76行)

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

#

KeepAlive Off

7、设置keepaliverequest,设置为0 的时候没有限制,不过最好还是用默认值,或者自己根据情况来改变。(大约83行)

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend ou leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100                          

Linux服务器---apache配置文件的更多相关文章

  1. Linux服务器---apache支持cgi

    Apache支持cgi  1.打开Apache配置文件httpd.conf,搜索“cgi”,找到下面的一段,去掉“addhandler”前面的“#“,这样就开启了Apache的cgi功能 [root@ ...

  2. centos linux服务器apache+mysql环境访问慢优化方法

    查找软件安装目录:find / -name 软件名称 一.优化apache配置增加MaxClients的值 默认情况下,2.0及以上apache版本MaxClients的值为256,对于中大型应用访问 ...

  3. Linux服务器---apache支持SSL

    Apache支持ssl 1.检测是否安装ssl模块,如果没有就安装 [root@localhost cgi-bin]# rpm -qa | grep mod_ssl           //查看是否安 ...

  4. linux服务器apache 一个IP,一个端口,建立多个网站的方法。

    找到apache-tomcat-6.0.14\conf\server.xml ,再services 后面添加此段代码: Xml代码 <!-- 此处  新增的项目配置-->  <Ser ...

  5. [linux]服务器apache配置vhost

    官网示例: http://httpd.apache.org/docs/current/vhosts/examples.html

  6. Atitit. 软件GUI按钮与仪表盘--web服务器区--获取apache配置文件路径 linux and apache的启动、停止、重启

    Atitit.   软件GUI按钮与仪表盘--web服务器区--获取apache配置文件路径 linux and apache的启动.停止.重启 可以通过"netstat -anp" ...

  7. linux 下 apache相关;启动、停止、重启命令;配置文件位置等等

    linux 下 apache启动.停止.重启命 基本的操作方法: 本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况 apahce启动命令: 推荐/usr/l ...

  8. Linux服务器部署系列之一—Apache篇(下)

    接上篇 linux服务器部署系列之一—Apache篇(上)    四.管理日志文件 Apache日志分为访问日志和错误日志两种: 1)访问日志 用于记录客户端的访问信息,文件名默认为access_lo ...

  9. Apache配置文件服务器

    配置Apache文件服务器: apache配置文件服务器httpd.conf中这两个模块必须不被注释LoadModule autoindex_module modules/mod_autoindex. ...

随机推荐

  1. eclipse打断点只进入class文件中的解决办法

    内容来源 https://www.cnblogs.com/scode2/p/8671908.html#undefined 是由于对应的Java类跟编译后的class文件,没有关联上, 解决办法: 在打 ...

  2. 关于51单片机使用printf串口调试

    在51系列单片机上面使用串口的时候,有时候为了方便调试看一下输出结果,会用到printf函数输出到电脑终端,再用串口助手显示.但是单片机使用printf的时候有一点需要注意的地方. 1.首先添加头文件 ...

  3. ELK之Logstash使用useragent获取浏览器版本、型号以及系统版本

    参考文档:http://www.51niux.com/?id=216    https://www.cnblogs.com/Orgliny/p/5755384.html Logstash中的 logs ...

  4. Kettle 4.2源码分析第一讲--Kettle 简介

    Pentaho Data Integration(PDI)简介 1. PDI结构简介 图 1‑1 PDI核心组件 Spoon是构建ETL Jobs和Transformations的工具.Spoon可以 ...

  5. Gym - 101532D Counting Test 前缀和统计字符串

    题意:给你一个1e4长的字符串S,有1e5个询问,每个询问形如 l r c ,其中l,r为左右边界,c为所询问的字符.注意,l,r,可以大于串S的长度,这种情况下认为S自身重复无数次(S+S+S··· ...

  6. PXE配置手记(Linux)

    服务器端:RHEL5(静态IP 192.168.1.101) 源Gentoo系统:服务器上的Gentoo系统就来自于它,编译内核也是在这台机器上执行的 无盘客户端:网卡是 AMD PCnet32 支持 ...

  7. PDB、PD、PMP、RTB哪个更好?为品牌主解锁程序化购买的选择技巧

    PDB.PD.PMP.RTB哪个更好?为品牌主解锁程序化购买的选择技巧 https://baijiahao.baidu.com/s?id=1620277114893208111&wfr=spi ...

  8. 将你的wordpress博客添加到百度个性首页

    当你登陆百度账号后,进入百度首页会显示新的个性首页,不仅仅有搜索框,下面还有一个小型导航,放着你经常去的网站. 百度提供了一键添加到百度首页的按钮代码. 首先,先打开分享到百度新首页代码申请页面:ht ...

  9. golang使用vet进行语法检查

    go tool vet是你的好朋友,不要忽视它. vet是一个优雅的工具,每个Go开发者都要知道并会使用它.它会做代码静态检查发现可能的bug或者可疑的构造.vet是Go tool套件的一部分,我们会 ...

  10. (Power Strings)sdutoj2475

    #include <stdio.h>#include <string.h>#include <stdlib.h>char a[1000001];int next[1 ...