Linux CentOS7 httpd 配置注释
本文首发:https://www.somata.net/2019/linux_centos_httpd_config_comment.html
如果没看懂可以去看看官方发布的文档 apache官方文档
conf/httpd.conf
ServerRoot "/etc/httpd" # 指定服务配置根目录
Listen 80 # 监听端口
Include conf.modules.d/*.conf # 包含模块配置文件
User apache # 使用的用户进程和组
Group apache
ServerAdmin root@localhost # 服务器管理员邮箱,用于错误提示。
DocumentRoot "/var/www/html" # 指定服务网页根目录
<Directory /> # 为指定目录设置不同权限
AllowOverride none # 禁止使用.htaccess 中的指令
Require all denied # 禁止所有访问
</Directory>
<Directory "/var/www">
AllowOverride None
Require all granted # 允许访问
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks # 允许的参数(索引(建议禁用),跟随软连接)
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html # 指定默认首页
</IfModule>
<Files ".ht*">
Require all denied # 禁止访问该文件
</Files>
ErrorLog "logs/error_log" # 日志记录
LogLevel warn
<IfModule log_config_module> # 日志配置
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>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined # 指定日志文件名和格式(结合)
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" # 路径别名
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module> # 指定文件格式和mime对应
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8 # 指定默认编码
<IfModule mime_magic_module>
MIMEMagicFile conf/magic # 指定mime
</IfModule>
EnableSendfile on # 开启sendfile功能
# sendfile功能必须在Linux kernel 2.1版本以后内核中才能开启
# sendfile功能直接跳过了将内容复制到用户缓冲区的过程,直接将文件内容复制到了socket缓冲区
# 加快了文件的发送速度。
IncludeOptional conf.d/*.conf
conf.d/autoindex.conf
IndexOptions FancyIndexing HTMLTable VersionSort # 索引选项
Alias /icons/ "/usr/share/httpd/icons/"
<Directory "/usr/share/httpd/icons">
Options Indexes MultiViews FollowSymlinks
AllowOverride None
Require all granted
</Directory>
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip # 根据文件编码来分配图标
AddIconByType (TXT,/icons/text.gif) text/* # 根据文件类型来分配图标
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe # 根据文件后缀来分配图标
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif /core
AddIcon /icons/bomb.gif */core.*
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif # 默认的未知文件
ReadmeName README.html # 和下面一个共同用于添加索引的上下文件内容
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t # 指定要隐藏的文件。
conf.d/welcome.conf
<LocationMatch "^/+$"> # 仅将该规则用于规则匹配的URL
Options -Indexes # 去除所有参数
ErrorDocument 403 /.noindex.html # 错误返回代码和网页
</LocationMatch>
<Directory /usr/share/httpd/noindex>
AllowOverride None
Require all granted
</Directory>
Alias /.noindex.html /usr/share/httpd/noindex/index.html
Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png
conf.d/ssl.conf
Listen 443 https
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog # 加密私钥的对话类型
SSLSessionCache shmcb:/run/httpd/sslcache(512000) # SSL对话密钥的存储位置
SSLSessionCacheTimeout 300 # SSL对话密钥的超时时间
SSLRandomSeed startup file:/dev/urandom 256 # 随机种子的获取地址
SSLRandomSeed connect builtin # 如果无法使用urandom则使用内置随机数生成器
SSLCryptoDevice builtin # 硬件加密策略,默认使用内置,可是使用openssl engine 插叙是否可是使用其他硬件加密策略
#SSLCryptoDevice rdrand # 这个是intel的硬件加密引擎
<VirtualHost _default_:443>
ErrorLog logs/ssl_error_log # 指定错误日志位置
TransferLog logs/ssl_access_log # 指定默认日志位置
LogLevel warn # 指定日志级别
SSLEngine on # 开启 SSL 加密引擎
SSLProtocol all -SSLv2 # 配置所加密策略可用,取消使用SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA # 密码交换策略
# HIGH:使用所有Triple-DES的密码
# MEDIUM:所有具有128位加密的密码
# 这里的 ! 是用于禁止指定的策略分别是aNULL(没有身份验证),MD5(MD5哈希函数),IDEA(IDEA加密)
SSLCertificateFile /etc/pki/tls/certs/localhost.crt # 证书存储位置
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key # 密钥存储位置
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars # 这里的选项是用于SSL连接的额外配置
# 主要是给脚本提供一些其他的与SSL相关环境变量,不过会消耗部分系统资源,推荐关闭。下同。
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \ # 这个是关于User-Agent的相关参数
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# 第一个参数是正则匹配User-Agent,然后会创建后面的环境这些环境变量,并且变量默认值为1
CustomLog logs/ssl_request_log \ # 日志参数
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
本文经「原本」原创认证,作者乾坤盘,访问yuanben.io查询【KWDNERPU】获取授权信息。
Linux CentOS7 httpd 配置注释的更多相关文章
- LInux CentOS7 vsftpd 配置注释
本文首发: https://www.somata.work/2019/LinuxCentOSvsftpdConfigComment.html vsftpd.conf anonymous_enable= ...
- centos7 httpd配置
centos7 httpd配置 标签(空格分隔): 未分类 隐藏server信息 修改httpd.conf 设置,添加如下两行 ServerSignature Off ServerTokens Pro ...
- Linux(CentOS7)下配置多个tomcat
记录 Linux(CentOS7) 下配置多个 tomcat 的操作过程. 一.下载tomcat 前提:安装配置好jdk环境,未配置可参考Linux(CentOS7)下安装jdk1.8. 从 tomc ...
- Linux使用httpd配置反代理
Linux安装httpd请看上一篇:https://www.cnblogs.com/tuituji27/p/11189095.html 首先,httpd默认监听端口号是80,增加或修改代理的端口号的文 ...
- linux CentOS7.2配置LNMP
转自http://www.centoscn.com/CentosServer/www/2014/0904/3673.html 准备篇: CentOS 7.0系统安装配置图解教程 http://www. ...
- Linux CentOS7 安装配置 IPtables
2021-08-11 1. 前言 防火墙其实就是实现 Linux 下访问控制功能的,分为硬件和软件的防火墙两种类型.无论在何网络中,防火墙工作的地方一定是网络的边缘.防火墙的策略.规则就是去定义防火墙 ...
- linux centos7 tomcat8 配置成服务启动
1. tomact 解压到/usr/local/tomcat下 2.vim /usr/local/tomcat/bin/catalina.sh 在OS specific support.前加上 (注意 ...
- Linux(Centos7.X ) 配置Java 环境变量
前提条件:上传Jdk 文件到Linux服务器上. tar -zxvf jdk-8u111-linux-x64.tar.gz 修改 /etc/profile 在打开的文件末尾添加如下内容: export ...
- Linux centos7.0 配置防火墙及开放端口
现在防火墙有两种服务1.service firewalld 2.service iptables 一.就firewalld来说查看开放的端口 netstat -anp 查询防火墙状态 servi ...
随机推荐
- 网页布局(html+css基础)
一.如何用CSS进行网页布局 二.网页布局基础 三.网页简单布局之结构和表现原则 四.CSS Sprite雪碧图应用 什么叫布局? 网页的特点: 网页自适应宽度: 网页长度无限延长: (分栏也叫分列, ...
- 【计算机视觉】Selective Search for Object Recognition论文阅读3
Selective Search for Object Recoginition surgewong@gmail.com http://blog.csdn.net/surgewong 在前 ...
- tab页签
<div class="fl" id="newsBox"> <div class="tab1 grayBar"> & ...
- 阿里云主机如何设置swap
简介:swap交换空间实际上是一个磁盘分区,在安装操作系统时,默认划分出物理内存的1~2倍空间用于交换分区,它类似于 Windows 的虚拟内存.系统会把一部分硬盘空间虚拟成内存使用,将系统内非活动内 ...
- laydate年份选择,关闭底框,点击指定年份就选择然后关闭控件,翻页不选择也不关闭控件
如下图,翻页不选择也不关闭.点击指定年份时再选择和关闭控件 代码如下 // 默认没有选择,把判断赋值当前时间 var iYearCode = parseInt(new Date().getFullYe ...
- Java 语言 ArrayList 和 JSONArray 相互转换
Java 语言 ArrayList 和 JSONArray 相互转换 本篇主要讲解 ArrayList 和 fastjson 中的 JSONArray相互转换的几种常用方式,以实体类 Student. ...
- 数位dp踩坑
前言 数位DP是什么?以前总觉得这个概念很高大上,最近闲的没事,学了一下发现确实挺神奇的. 从一道简单题说起 hdu 2089 "不要62" 一个数字,如果包含'4'或者'62', ...
- SQL概要与表的创建
SQL概要与表的创建 1.表的结构 关系数据库通过类似Excel 工作表那样的.由行和列组成的二维表来管理数据.用来管理数据的二维表在关系数据库中简称为表. 根据SQL 语句的内容返回的数据同 ...
- Linux十大顶级发行版本
当前顶级发行版概览 对于Linux新手来说,在各发行版之间困惑得进行选择和不断增加的数量实在令人头晕.这就是写作本文的原因,其中列出的10个(附加一个值得一提的FreeBSD,BSD一族中最为流行 ...
- go 结构体2 文法
结构体文法表示通过结构体字段的值作为列表来新分配一个结构体. 使用 Name: 语法可以仅列出部分字段.(字段名的顺序无关.) 特殊的前缀 & 返回一个指向结构体的指针. //分配的v1结构体 ...