实验环境:

CentOS6.8

1、连接测试:

  在/etc/httpd/conf/httpd.conf

  telnet 172.16.252.242 80

  GET /index.html HTTP/1.1

  Host: 172.16.252.242

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off  #长连接状态是关闭的

[root@www ~18:47:34]#telnet 172.16.252.242 80
Trying 172.16.252.242...
Connected to 172.16.252.242.
Escape character is '^]'.
GET /index.html HTTP/1.1
Host: 172.16.252.242Connection closed by foreign host.

修改KeepAlive:/etc/httpd/conf/httpd.conf

KeepAlive On  #开启
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15  #等待时间

[root@conf localhost6]#service httpd restart  #修改配置文件,必须重新启动服务
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for localhost6.8.localdomain
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]

#此时一次请求结束后,不会退出,而是等待下次请求,超过等待时间,则退出

2、http的访问控制——认证

  1)在主配置文件定义安全域

# 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 "/www/host1/"#此目录下有个目录admin下的文件需要用户进行http的认证访问

[root@admin localhost6]#pwd
/www/host1/admin
[root@admin localhost6]#cat admin.html   #此文件需要认证才能访问
<h1> warn:admin area</h1>

[root@admin localhost6]#vi /etc/httpd/conf/httpd.conf  #配置的文件

<Directory "/www/host1/admin/">   #认证后才能显示的目录Options None         #INDEXES等设置不生效AllowOverride None      #覆盖不生效Authtype Basic        #认证方式:basic和digestAuthname "input your username and passwd" #认证提示页显示Authuserfile "/etc/httpd/conf/.htpasswd"  #认证校验的密码文件require user tom              #需要认证的用户
#       require valid-user             #密码文件中的用户都需要认证
</Directory>

2)创建账号和密码校验的加密文件

[root@admin localhost6]#htpasswd -c -m /etc/httpd/conf/.htpasswd tom
New password:
Re-type new password:
Adding password for user tom
[root@admin localhost6]#htpasswd  -m /etc/httpd/conf/.htpasswd jey
New password:
Re-type new password:
Adding password for user jey#-c:自动创建指定的密码文件,仅首次创建文件时使用#-m:用md5加密方式进行加密#tom;需要认证的用户

#重启服务:[root@admin localhost6]#service httpd reload
Reloading httpd: 

输入用户名和密码进行验证。

转载于:https://www.cnblogs.com/wzhuo/p/6883017.html

httpd服务相关实验相关推荐

  1. 实验图文详解——apache的编译安装及httpd服务开机自启

    实验图文详解--apache的编译安装及httpd服务开机自启 1.导入安装包 2.解压安装包 3.分别解压httpd.apr.apr-util包 4.对apr.apr-util目录进行移动及重命名操 ...

  2. 【评测】iPS细胞相关实验服务机构-魔法师的仓库

    由血液细胞重编程得到iPS细胞是一个经典实验,但由于实验周期长.涉及实验方法多.实验繁琐,对于没有受到过系统培训的人员,还是有一定难度的.现在,您可以选择我们的iPS细胞相关实验服务,节省您宝贵的时间 ...

  3. 源码编译安装httpd服务

    1 概述 很多软件没有发布rpm包,而是直接发布了源码,好处是这样能兼容更多的平台,但是,用户需要对源码进行编译后安装.利用工具make将源码生成二进制文件. 本文主要讲解了对httpd进行编译安装. ...

  4. tomcat相关实验

    tomcat相关实验 1.实现LNT 同主机实现 1.安装并启动tomcat 1)OpenJDK的安装yum install java-1.8.0-openjdk-devel.x86_64 确定JDK ...

  5. httpd服务及配置文件详解

    一.Httpd服务 httpd是一个开源软件,且一般用作web服务器来使用.目前最流行的web服务器软件叫做httpd, 在早期的http server就叫做apache,到了http server ...

  6. 利用httpd服务搭建wordpress、phpmyad及discuz平台

    实验一:基于lamp搭建wordpress blog 1.利用yum工具安装相关的软件包 2.关闭Selinux和防火墙 3.编辑httpd服务的系统文件 4.开启httpd服务 5.编辑MySQL的 ...

  7. InfluxDB源码阅读之httpd服务

    操作系统 : CentOS7.3.1611_x64 go语言版本:1.8.3 linux/amd64 InfluxDB版本:1.1.0 服务模块介绍 源码路径: github.com/influxda ...

  8. httpd 服务的两个节点的HA

    实验目的是:实现两个节点的http和nfs服务的HA集群. 实现条件:准备两个节点.node1,node2作为HA1,HA2提供集群服务.在node1和node2分别按照httpd服务.挂载nfs服务 ...

  9. httpd服务配置(未完待续)

    httpd服务的详细配置 程序环境 主配置文件: /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/*.conf 服务脚本: /etc/rc.d/init.d/ ...

最新文章

  1. 声称代码已开源却迟迟没更新,网友等了好几个月,最终一怒之下把作者挂网上...
  2. 大道至简,回归到梦开始的地方。人生如此,编程亦如此。
  3. 【Android 逆向】加壳的 Android 应用启动流程 | 使用反射替换 LoadedApk 中的类加载器流程
  4. 孙钟秀--《操作系统教程》注释(陈怀临)-- 读书笔记
  5. Invalid bound statement (not found) 解决方案
  6. 矩阵求导术(上、下)
  7. 基于升序链表的定时器
  8. java emoji显示乱码_Java 解决Emoji表情过滤问题
  9. python多线程写同一个文件_Python多线程快速写入文件,python,飞速
  10. html5转PDF软件,html转pdf软件(wkhtmltopdf) 0.12.5官方版
  11. 如何在revit中管理CAD的图层?
  12. html禁止查看图片,强看被屏蔽微信朋友圈
  13. 项目保密协议书(范本)
  14. 利用kali Linux进行中间人攻击
  15. android获取手机号码的归属地以及运营商,本地查询
  16. Nginx 实现文件夹上传(保留目录结构)
  17. oracle 配置变更记录,Oracle安装、配置和.NET访问的简单记录
  18. word如何给数学公式编号
  19. [python小工具]随机调用一个浏览器打开网页
  20. 程序员是不是只在乎自己的一亩三分地

热门文章

  1. zencoding实践
  2. a different object with the same identifier value was already associated with the session
  3. input core input.c (1)
  4. pap和chap交叉认证
  5. CSLA .NET概述
  6. Spring Cloud企业微服务分布式云架构技术点整合
  7. 关于Unity四元数相乘先后顺序的问题
  8. Linux堆内存管理深入分析(上)
  9. 粒子群算法(1)----粒子群简要
  10. 关于yum库的相关问题