Linux服务器---apache配置文件

简介:
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                           
相关文章
|
13天前
|
网络安全 Apache
Apache服务器安装SSL证书
Apache服务器安装SSL证书
18 0
|
13天前
|
Java Linux
Springboot 解决linux服务器下获取不到项目Resources下资源
Springboot 解决linux服务器下获取不到项目Resources下资源
|
17天前
|
Linux
linux下搭建tftp服务器教程
在Linux中搭建TFTP服务器,需安装`tftp-server`(如`tftpd-hpa`)。步骤包括:更新软件包列表,安装`tftpd-hpa`,启动并设置开机自启,配置服务器(编辑`/etc/default/tftpd-hpa`),添加选项,然后重启服务。完成后,可用`tftp`命令进行文件传输。例如,从IP`192.168.1.100`下载`file.txt`: ``` tftp 192.168.1.100 &lt;&lt;EOF binary put file.txt quit EOF ```
28 4
|
3天前
|
网络协议 安全 Linux
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
|
4天前
|
存储 Java 网络安全
ZooKeeper【搭建 03】apache-zookeeper-3.6.0 伪集群版(一台服务器实现三个节点的ZooKeeper集群)
【4月更文挑战第10天】ZooKeeper【搭建 03】apache-zookeeper-3.6.0 伪集群版(一台服务器实现三个节点的ZooKeeper集群)
12 1
|
9天前
|
Linux 数据安全/隐私保护
Linux基础与服务器架构综合小实践
【4月更文挑战第9天】Linux基础与服务器架构综合小实践
1219 8
|
21天前
|
Ubuntu Linux 虚拟化
【Linux】ubuntu安装samba服务器
【Linux】ubuntu安装samba服务器
|
22天前
|
Linux
Linux安装bind9搭建自己的域名服务器
Linux安装bind9搭建自己的域名服务器
11 0
|
22天前
|
Java Linux
Linux运行jar并选择配置文件
Linux运行jar并选择配置文件
8 1
|
24天前
|
网络协议 Linux 网络安全
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
Linux服务器DNS服务器配置实现bind的正向解释和反向解释
17 0