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. ubuntu1304无法启动桌面系统的问题和解决

    今天上班,从oracle官网下载个最新的virtual box,安装后重启电脑,进入桌面后竟然没有菜单栏和启动栏了(就是最上边的bar和左边的应用栏),而且所有启动的窗口都没有菜单栏,终端什么的也都没 ...

  2. zTree实现节点修改的实时刷新

    一.应用场景 在实际应用中会遇到动态操作树各节点的需求,在增加树节点后如何实时动态刷新树就十分有必要了. 二.项目实践   比如要在test1234节点下新建子节点,首先要选中test1234节点,添 ...

  3. android speakerphone/

    http://www.cnblogs.com/innost/archive/2011/01/22/1942149.html http://blog.sina.com.cn/s/blog_5418969 ...

  4. Mybatis 代码自动生成[myeclipse版]

    使用环境说明: OS:windows 7 64位 myeclipse: 2017 CI 1.安装 打开myeclipse--help---Install from catalog--选择eclipse ...

  5. 常用社交网络(微博等)动态新闻(feed、新鲜事)系统浅析(转)

    add by zhj:同时也看看国外牛逼公司是怎么做的吧 Stream-Framework    Python实现的feed Twitter 2013 Redis based, database fa ...

  6. IO流(2)创建文件或文件夹

    创建功能: *public boolean createNewFile():创建文件 如果存在这样的文件,就不创建了 *public boolean mkdir():创建文件夹 如果存在这样的文件夹, ...

  7. 【Python】Pycharm2018激活方式【亲测好用】

    2.激活码激活 优点:Window.Mac.Ubantu都稳定有效,关键是这种激活方式不会产生其他影响 缺点:需要修改hosts文件 修改hosts文件将0.0.0.0 account.jetbrai ...

  8. windows环境下为php打开ssh2扩展

    安装步骤 1. 下载 php extension ssh2下载地址 http://windows.php.net/downloads/pecl/releases/ssh2/0.12/ 根据自己PHP的 ...

  9. Andrew Ng-ML-第十七章-推荐系统

    1.问题规划  图1.推荐系统在研究什么? 例子:预测电影的评分. 当知道n_u用户数,n_m电影数:r(i,j)用户j评价了电影i,那么就是1:y(i,j)如果r(i,j)为1,那么就给出评分. 问 ...

  10. [LeetCode] 207 Course Schedule_Medium tag: BFS, DFS

    There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prereq ...