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                           
相关文章
|
6月前
|
弹性计算 安全 Linux
阿里云服务器ECS安装宝塔Linux面板、安装网站(新手图文教程)
本教程详解如何在阿里云服务器上安装宝塔Linux面板,涵盖ECS服务器手动安装步骤,包括系统准备、远程连接、安装命令执行、端口开放及LNMP环境部署,手把手引导用户快速搭建网站环境。
|
8月前
|
Linux 网络安全 数据安全/隐私保护
使用Linux系统的mount命令挂载远程服务器的文件夹。
如此一来,你就完成了一次从你的Linux发车站到远程服务器文件夹的有趣旅行。在这个技术之旅中,你既探索了新地方,也学到了如何桥接不同系统之间的距离。
1439 21
|
7月前
|
Java Linux 网络安全
Linux云端服务器上部署Spring Boot应用的教程。
此流程涉及Linux命令行操作、系统服务管理及网络安全知识,需要管理员权限以进行配置和服务管理。务必在一个测试环境中验证所有步骤,确保一切配置正确无误后,再将应用部署到生产环境中。也可以使用如Ansible、Chef等配置管理工具来自动化部署过程,提升效率和可靠性。
718 13
|
7月前
|
监控 Linux 网络安全
FinalShell SSH工具下载,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux
FinalShell是一款国人开发的多平台SSH客户端工具,支持Windows、Mac OS X和Linux系统。它提供一体化服务器管理功能,支持shell和sftp同屏显示,命令自动提示,操作便捷。软件还具备加速功能,提升访问服务器速度,适合普通用户和专业人士使用。
2464 0
|
7月前
|
存储 安全 Linux
Linux服务器上安装配置GitLab的步骤。
按照以上步骤,一个基础的GitLab服务应该运行并可以使用。记得定期检查GitLab官方文档,因为GitLab的安装和配置步骤可能随着新版本而变化。
735 0
|
9月前
|
存储 安全 Ubuntu
从Linux到Windows:阿里云服务器系统镜像适配场景与选择参考
阿里云为用户提供了丰富多样的服务器操作系统选择,以满足不同场景下的应用需求。目前,云服务器的操作系统镜像主要分为公共镜像、自定义镜像、共享镜像、镜像市场和社区镜像五大类。以下是对这些镜像类型的详细介绍及选择云服务器系统时需要考虑的因素,以供参考。
|
8月前
|
Linux
Linux下版本控制器(SVN) -服务器端环境搭建步骤
Linux下版本控制器(SVN) -服务器端环境搭建步骤
333 0
Linux下版本控制器(SVN) -服务器端环境搭建步骤
|
9月前
|
数据挖掘 Linux 数据库
服务器数据恢复—Linux系统服务器数据恢复案例
服务器数据恢复环境: linux操作系统服务器中有一组由4块SAS接口硬盘组建的raid5阵列。 服务器故障: 服务器工作过程中突然崩溃。管理员将服务器操作系统进行了重装。 用户方需要恢复服务器中的数据库、办公文档、代码文件等。
|
域名解析 Linux Apache
Linux Apache服务详解——虚拟网站主机功能实战
Linux Apache服务详解——虚拟网站主机功能实战
412 5
|
运维 Linux Apache
Linux Apache服务详解——Apache虚拟目录与禁止显示目录列表实战
Linux Apache服务详解——Apache虚拟目录与禁止显示目录列表实战
341 2