博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
httpd服务相关实验
阅读量:6983 次
发布时间:2019-06-27

本文共 2550 字,大约阅读时间需要 8 分钟。

实验环境:

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 80Trying 172.16.252.242...Connected to 172.16.252.242.Escape character is '^]'.GET /index.html HTTP/1.1Host: 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   #此文件需要认证才能访问

warn:admin area

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

   #认证后才能显示的目录 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             #密码文件中的用户都需要认证

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

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

 

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

 

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

 

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

你可能感兴趣的文章
Java:正则表达式
查看>>
tensorflow
查看>>
mysql分表的3种方法
查看>>
TableControl大小变化
查看>>
返回脚本所在目录
查看>>
[LeetCode] No. 9 Palindrome Number
查看>>
(转)GCT之逻辑经验总结(拿来主义)
查看>>
虚拟继承中子类和父类的构造函数顺序1
查看>>
js错误: Unexpected number in JSON at position 2792 value里面有双引号怎么解决
查看>>
(实践篇)剖析最近项目使用的一个框架
查看>>
tigerVNC的简单使用教程(CentOS的远程桌面连接)
查看>>
组合数据类型综合练习:英文词频统计
查看>>
文献综述八:基于JAVA的商品网站的研究
查看>>
iOS 应用有用户评论功能 因为潜在色情信息被退回解决方案
查看>>
usaco Typo
查看>>
DataTable 实现新增加合计行
查看>>
字符串
查看>>
创建对象的三种方式
查看>>
spring学习之spring 插件 for eclipse
查看>>
js-sha256源码
查看>>