实验环境:

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.242
Connection 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和digest
Authname "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:

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

httpd服务相关实验的更多相关文章

  1. DHCP服务相关实验

    一.DHCP 相关介绍 1.dhcp服务相关 软件名: dhcp #DHCP服务软件包 dhcp-common #DHCP命令软件包(默认已安装) 服务名: dhcpd #DHCP服务名 dhcrel ...

  2. Httpd服务进阶知识-LAMP源码编译安装

    Httpd服务进阶知识-LAMP源码编译安装 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 想必大家都知道,动态资源交给fastcgi程序处理,静态资源依旧由httpd服务器处理  ...

  3. rsync 服务介绍及相关实验

    一.rsync 简介 rsync 是类 unix 系统下的数据镜像备份工具.一款支持快速完全备份和增量备份的工具,支持本 地复制,远程同步等,类似于 scp 命令:rsync 命令在同步文件之前要先登 ...

  4. 手动配置三台虚拟机pacemaker+corosync并添加httpd服务

    创建三台虚拟机,实验环境:centos7.1,选择基础设施服务安装. 每台虚拟机两块网卡,第一块为pxe,第二块连通外网,手动为两块网卡配置IP.网关,使它们都能ping通外网并可以互相通过hostn ...

  5. tomcat相关实验

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

  6. Httpd服务进阶知识-基于FASTCGI实现的LAMP架构

    Httpd服务进阶知识-基于FASTCGI实现的LAMP架构 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.httpd+php结合的方式 module: php fastcgi ...

  7. Httpd服务入门知识-http协议版本,工作机制及http服务器应用扫盲篇

    Httpd服务入门知识-http协议版本,工作机制及http服务器应用扫盲篇 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Internet与中国 Internet最早来源于美 ...

  8. HTTPD之二————HTTPD服务详解————httpd的配置文件常见设置

    HTTPD之二----HTTPD服务详解----httpd的配置文件常见设置 HTTP服务器应用 http服务器程序 httpd apache nginx lighttpd 应用程序服务器 IIS,a ...

  9. 启动httpd服务:SSLCertificateFile: file '/var/www/miq/vmdb/certs/server.cer' does not exist or is empty

    启动httpd服务,失败: [root@test vmdb]# service httpd restart Stopping httpd: [FAILED] Starting httpd: Synta ...

随机推荐

  1. 【虚拟机】WIN8.1系统安装虚拟机win7环境

    一.虚拟机的安装 1.准备 VMware Workstation 的软硬件支持,请查看 http://www.vmware.com/cn/products/workstation.html#techs ...

  2. 图像处理之全景拼接---基于sift的全景图像拼接

    http://blog.csdn.net/masibuaa/article/details/9246493#comments

  3. Python学习总结之二 -- 数据类型

    带你走进数据类型 一:整数.浮点数 Python中整数和浮点数的定义以及运算和C++都是一样的,我在这里就不需多说了,我就说明一点:Python相对于C/C++而言,定义整数没有int 和 long ...

  4. 使用Reveal来查看别人的APP界面+白苹果不刷机解决方式

    Reveal这个强大的界面调试工具.能够实时查看.改动view的属性,大体上实现了iOS程序猿梦寐以求的功能.比方,有时候我们加入了一个view,可是那个view死活不显示出来,这时候祭出Reveal ...

  5. 《Linux 鸟哥私房菜》 第6章 Linux的文件权限与目录配置

    1.文件的类型与权限. 如图红框.权限与类型共有10个字符组成. (1)第一个字符代表这个文件是“目录.文件或链接文件等”. [d]则是目录 [-]则是文件 [|]则是连接文件 [b]则是设备文件里面 ...

  6. mapreduce的一个模版

    import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import j ...

  7. client网络优化方法

    减小图片大小(使用WebP格式的图片)  大部分的Facebook应用数据都是图片,因此降低图片的大小就能够较少数据的下载量.从而加快下载速度,这一点在高延迟的网络环境下很重要.Facebook返回给 ...

  8. 您使用的是不受支持的命令行标记 chrome

    检查 chrome://flags/#extensions-on-chrome-urls 是否开启 开启了的话就关掉检查 启动chrome的快捷方式是否在目标后有额外的参数 有就删了 在浏览器中输入c ...

  9. Node.js学习笔记(1):Node.js快速开始

    Node.js学习笔记(1):Node.js快速开始 Node.js的安装 下载 官方网址:https://nodejs.org/en/ 说明: 在Windows上安装时务必选择全部组件,包括勾选Ad ...

  10. 6410开发板sd卡启动时烧写u-boot.bin以及u-boot-spl-16k.bin步骤

    参考文档:<SMDK6410_IROM_APPLICATION NOTE_REV 1.00>(可以从这里下载到> 参考博客:Tekkaman的博文<u-boot-2010.09 ...