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. TFS二次开发系列索引

    TFS二次开发11——标签(Label) TFS二次开发10——分组(Group)和成员(Member) TFS二次开发09——查看文件历史(QueryHistory) TFS二次开发08——分支(B ...

  2. tomcat使用中的积累

    一.清理tomcat缓存 项目运行出错,如:找不到某个类或方法,可能是没有部署好,而不是项目本身的问题.这个时候要重新部署.tomcat有缓存,所以有时候需要清理tomcat缓存再重新部署. 常用的几 ...

  3. SQL Fundamentals || Single-Row Functions || 通用函数 General function || (NVL,NVL2,NULLIF,DECODE,CASE,COALESCE)

    SQL Fundamentals || Oracle SQL语言 SQL Fundamentals: Using Single-Row Functions to Customize Output使用单 ...

  4. POJ - 1088 滑雪 dp

    http://bailian.openjudge.cn/practice/1088?lang=en_US 题解: 设一个dp[N][N]数组代表从(i,j)坐标开始能滑到的最远距离.更新的方法为 遍历 ...

  5. iOS-多语言版本开发(二)(转载)

    题记   iOS 多语言版本的开发(一) 中我们完成了让应用跟随系统语言进行切换,而用户自己却不能切换的功能,也基本上算是实现了多语言版本:可是,对于某些应用来说,实现跟随系统语言切换的同时, 也想要 ...

  6. GA安装

  7. 优云软件应邀出席 ITSS 数据中心运营管理工作组 2017 年春季研讨会

    2017 年 4 月 15 日,中国电子工业标准化技术协会信息技术服务分会(以下称 ITSS 分会)数据中心运营管理工作组(以下简称 DCMG)在江苏省启东市召开春季研讨会. DCMG 工作组组长肖建 ...

  8. 【python-opencv】20-图像金字塔

    知识点介绍 图像金字塔原理: 高斯金字塔 拉普拉斯金字塔: 代码层面知识点:  cv2.PyrDown:降采样  cv2.PyrUp:升采样 高斯金字塔与拉普拉斯金字塔 图像金字塔是图像中多尺度表达的 ...

  9. Memcached集群架构方面的问题(转)

    add by zhj: 这是一个系列中的第二篇,该系列有四篇,英文原文没找到,译文见:http://blog.csdn.net/jarfield/article/details/4336035 ,附上 ...

  10. 《javascript算法--对象的比较》

    方法一:JSON.stringify() 此方法简单,适用于当两个对象的属性顺序相同的时候. var user1 = {name : "nerd", org: "dev& ...