#FollowSymLinks 在WEB站点根目录允许使用链接文件
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
#不许使用权限复写
AllowOverride None
#
# Controls who can get stuff from this server.
#
#允许所有人访问网站根目录
Require all granted
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#指定站点的默认索引文件
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
#是否允许在目录下使用.htaccess 和 .htpassswd文件设置客户端对网站目录访问权限
#.htaccess 访问控制
#.htpasswd 用户登陆验证
#拒绝在目录下使用.ht开头的文件
<Files ".ht*">
Require all denied
</Files>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
#错误日志
ErrorLog "logs/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
#错误日志记录级别:debug, info, notice, warn, error, crit,alert, emerg.
LogLevel warn
#启用日志模块
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
#定义日志格式 LogFormat "日志格式" 日志格式名称
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# 在访问日志中记录每个请求的输入输出字节 %I input %O output
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
#定义访问日志路径及日志格式
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
#使用目录映射
<IfModule alias_module>
#
# URL重定向
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#URL重定向 Redirect 方法 选项
#不同机器重定向将访问http://IP/abc 的用户 重定向访问 http:/
Redirect permanent /abc http://
#本机内部URL重定向 http://IP/123 http://IP/7878 注意:被重定向的目录必须存在 比如7878必须有
Redirect permanent /123 /7878
#seeother 表示改资源被替换过
Redirect seeother /123 /7878
#gone 表示改资源被移除了
Redirect gone /123
#permanent 永久重定向 301
#temp 临时重定向
#seeother 返回一个seeother状态码(303)提示这个资源被替代
#gone 返回一个gone状态码(410)提示这个资源被永久删除了
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2730/viewspace-3170925/ ,如需转载,请注明出处,否则将追究法律责任。