美文网首页
httpd的设置

httpd的设置

作者: 尘曦的雨 | 来源:发表于2017-08-07 17:00 被阅读23次

URL的别名

<Directory "/app/www/html">
Options Indexes
#定义了/app/www/html 网页主目录没有,就会显示文件目录
AllowOverride All
#这个指令定义了是否允许在数据目录下创建.与访问控制相关的哪些指令可以放在指定目录下的.htaccess (由AccessFileName 指定)文
件中,覆盖之前的配置指令只对<directory> 语句有效AllowOverride All:  所有指令都有效AllowOverride None :.htaccess  文件无>
效AllowOverride AuthConfig Indexes  除了AuthConfig和Indexes</Directory>
#
Alias /hy /etc/passwd
#URL别名定义
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
-- 插入 --                                                                                             361,17-13     34%

客户端访问

  • 配置基于用户的访问控制;安装生产用户与密码的工具
    [root@root html]# yum -y install http-tools
  • 生成秘钥
[root@root html]# htpasswd -s /etc/httpd/conf.d/.htusers chenxi
New password: 
Re-type new password: 
Adding password for user chenxi
[root@root html]# cat /etc/httpd/conf.d/.htusers
chenxi2:lb1QBQV7Tj7tw
chenxi:{SHA}9FQtubow95WK5CwRPdh60h+y7ds=
[root@root html]# 
  • 设置允许用户目录下的.htaccess
<Directory "/var/www/html">  网页目录

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
    Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#

#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all  允许网页目录下的.htaccess文件里所有设置生效

</Directory>
[root@root html]# vim .htaccess 

AuthType Basic
AuthName "String“
AuthUserFile "/etc/httpd/conf.d/.htusers"
Require valid-user
~                                         

虚拟主机设置


基于端口的虚拟主机设置


基于名字的虚拟主机


在网页上显示工作状态

相关文章

网友评论

      本文标题:httpd的设置

      本文链接:https://www.haomeiwen.com/subject/kbkylxtx.html