本文首发:https://www.somata.net/2019/linux_centos_httpd_config_comment.html

如果没看懂可以去看看官方发布的文档 apache官方文档

conf/httpd.conf

  1. ServerRoot "/etc/httpd" # 指定服务配置根目录
  2. Listen 80 # 监听端口
  3. Include conf.modules.d/*.conf # 包含模块配置文件
  4. User apache # 使用的用户进程和组
  5. Group apache
  6. ServerAdmin root@localhost # 服务器管理员邮箱,用于错误提示。
  7. DocumentRoot "/var/www/html" # 指定服务网页根目录
  8. <Directory /> # 为指定目录设置不同权限
  9. AllowOverride none # 禁止使用.htaccess 中的指令
  10. Require all denied # 禁止所有访问
  11. </Directory>
  12. <Directory "/var/www">
  13. AllowOverride None
  14. Require all granted # 允许访问
  15. </Directory>
  16. <Directory "/var/www/html">
  17. Options Indexes FollowSymLinks # 允许的参数(索引(建议禁用),跟随软连接)
  18. AllowOverride None
  19. Require all granted
  20. </Directory>
  21. <IfModule dir_module>
  22. DirectoryIndex index.html # 指定默认首页
  23. </IfModule>
  24. <Files ".ht*">
  25. Require all denied # 禁止访问该文件
  26. </Files>
  27. ErrorLog "logs/error_log" # 日志记录
  28. LogLevel warn
  29. <IfModule log_config_module> # 日志配置
  30. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  31. LogFormat "%h %l %u %t \"%r\" %>s %b" common
  32. <IfModule logio_module>
  33. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  34. </IfModule>
  35. CustomLog "logs/access_log" combined # 指定日志文件名和格式(结合)
  36. </IfModule>
  37. <IfModule alias_module>
  38. ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" # 路径别名
  39. </IfModule>
  40. <Directory "/var/www/cgi-bin">
  41. AllowOverride None
  42. Options None
  43. Require all granted
  44. </Directory>
  45. <IfModule mime_module> # 指定文件格式和mime对应
  46. TypesConfig /etc/mime.types
  47. AddType application/x-compress .Z
  48. AddType application/x-gzip .gz .tgz
  49. AddType text/html .shtml
  50. AddOutputFilter INCLUDES .shtml
  51. </IfModule>
  52. AddDefaultCharset UTF-8 # 指定默认编码
  53. <IfModule mime_magic_module>
  54. MIMEMagicFile conf/magic # 指定mime
  55. </IfModule>
  56. EnableSendfile on # 开启sendfile功能
  57. # sendfile功能必须在Linux kernel 2.1版本以后内核中才能开启
  58. # sendfile功能直接跳过了将内容复制到用户缓冲区的过程,直接将文件内容复制到了socket缓冲区
  59. # 加快了文件的发送速度。
  60. IncludeOptional conf.d/*.conf

conf.d/autoindex.conf

  1. IndexOptions FancyIndexing HTMLTable VersionSort # 索引选项
  2. Alias /icons/ "/usr/share/httpd/icons/"
  3. <Directory "/usr/share/httpd/icons">
  4. Options Indexes MultiViews FollowSymlinks
  5. AllowOverride None
  6. Require all granted
  7. </Directory>
  8. AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip # 根据文件编码来分配图标
  9. AddIconByType (TXT,/icons/text.gif) text/* # 根据文件类型来分配图标
  10. AddIconByType (IMG,/icons/image2.gif) image/*
  11. AddIconByType (SND,/icons/sound2.gif) audio/*
  12. AddIconByType (VID,/icons/movie.gif) video/*
  13. AddIcon /icons/binary.gif .bin .exe # 根据文件后缀来分配图标
  14. AddIcon /icons/binhex.gif .hqx
  15. AddIcon /icons/tar.gif .tar
  16. AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
  17. AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
  18. AddIcon /icons/a.gif .ps .ai .eps
  19. AddIcon /icons/layout.gif .html .shtml .htm .pdf
  20. AddIcon /icons/text.gif .txt
  21. AddIcon /icons/c.gif .c
  22. AddIcon /icons/p.gif .pl .py
  23. AddIcon /icons/f.gif .for
  24. AddIcon /icons/dvi.gif .dvi
  25. AddIcon /icons/uuencoded.gif .uu
  26. AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
  27. AddIcon /icons/tex.gif .tex
  28. AddIcon /icons/bomb.gif /core
  29. AddIcon /icons/bomb.gif */core.*
  30. AddIcon /icons/back.gif ..
  31. AddIcon /icons/hand.right.gif README
  32. AddIcon /icons/folder.gif ^^DIRECTORY^^
  33. AddIcon /icons/blank.gif ^^BLANKICON^^
  34. DefaultIcon /icons/unknown.gif # 默认的未知文件
  35. ReadmeName README.html # 和下面一个共同用于添加索引的上下文件内容
  36. HeaderName HEADER.html
  37. IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t # 指定要隐藏的文件。

conf.d/welcome.conf

  1. <LocationMatch "^/+$"> # 仅将该规则用于规则匹配的URL
  2. Options -Indexes # 去除所有参数
  3. ErrorDocument 403 /.noindex.html # 错误返回代码和网页
  4. </LocationMatch>
  5. <Directory /usr/share/httpd/noindex>
  6. AllowOverride None
  7. Require all granted
  8. </Directory>
  9. Alias /.noindex.html /usr/share/httpd/noindex/index.html
  10. Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
  11. Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
  12. Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
  13. Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png

conf.d/ssl.conf

  1. Listen 443 https
  2. SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog # 加密私钥的对话类型
  3. SSLSessionCache shmcb:/run/httpd/sslcache(512000) # SSL对话密钥的存储位置
  4. SSLSessionCacheTimeout 300 # SSL对话密钥的超时时间
  5. SSLRandomSeed startup file:/dev/urandom 256 # 随机种子的获取地址
  6. SSLRandomSeed connect builtin # 如果无法使用urandom则使用内置随机数生成器
  7. SSLCryptoDevice builtin # 硬件加密策略,默认使用内置,可是使用openssl engine 插叙是否可是使用其他硬件加密策略
  8. #SSLCryptoDevice rdrand # 这个是intel的硬件加密引擎
  9. <VirtualHost _default_:443>
  10. ErrorLog logs/ssl_error_log # 指定错误日志位置
  11. TransferLog logs/ssl_access_log # 指定默认日志位置
  12. LogLevel warn # 指定日志级别
  13. SSLEngine on # 开启 SSL 加密引擎
  14. SSLProtocol all -SSLv2 # 配置所加密策略可用,取消使用SSLv2
  15. SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA # 密码交换策略
  16. # HIGH:使用所有Triple-DES的密码
  17. # MEDIUM:所有具有128位加密的密码
  18. # 这里的 ! 是用于禁止指定的策略分别是aNULL(没有身份验证),MD5(MD5哈希函数),IDEA(IDEA加密)
  19. SSLCertificateFile /etc/pki/tls/certs/localhost.crt # 证书存储位置
  20. SSLCertificateKeyFile /etc/pki/tls/private/localhost.key # 密钥存储位置
  21. <Files ~ "\.(cgi|shtml|phtml|php3?)$">
  22. SSLOptions +StdEnvVars # 这里的选项是用于SSL连接的额外配置
  23. # 主要是给脚本提供一些其他的与SSL相关环境变量,不过会消耗部分系统资源,推荐关闭。下同。
  24. </Files>
  25. <Directory "/var/www/cgi-bin">
  26. SSLOptions +StdEnvVars
  27. </Directory>
  28. BrowserMatch "MSIE [2-5]" \ # 这个是关于User-Agent的相关参数
  29. nokeepalive ssl-unclean-shutdown \
  30. downgrade-1.0 force-response-1.0
  31. # 第一个参数是正则匹配User-Agent,然后会创建后面的环境这些环境变量,并且变量默认值为1
  32. CustomLog logs/ssl_request_log \ # 日志参数
  33. "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
  34. </VirtualHost>

本文经「原本」原创认证,作者乾坤盘,访问yuanben.io查询【KWDNERPU】获取授权信息。

Linux CentOS7 httpd 配置注释的更多相关文章

  1. LInux CentOS7 vsftpd 配置注释

    本文首发: https://www.somata.work/2019/LinuxCentOSvsftpdConfigComment.html vsftpd.conf anonymous_enable= ...

  2. centos7 httpd配置

    centos7 httpd配置 标签(空格分隔): 未分类 隐藏server信息 修改httpd.conf 设置,添加如下两行 ServerSignature Off ServerTokens Pro ...

  3. Linux(CentOS7)下配置多个tomcat

    记录 Linux(CentOS7) 下配置多个 tomcat 的操作过程. 一.下载tomcat 前提:安装配置好jdk环境,未配置可参考Linux(CentOS7)下安装jdk1.8. 从 tomc ...

  4. Linux使用httpd配置反代理

    Linux安装httpd请看上一篇:https://www.cnblogs.com/tuituji27/p/11189095.html 首先,httpd默认监听端口号是80,增加或修改代理的端口号的文 ...

  5. linux CentOS7.2配置LNMP

    转自http://www.centoscn.com/CentosServer/www/2014/0904/3673.html 准备篇: CentOS 7.0系统安装配置图解教程 http://www. ...

  6. Linux CentOS7 安装配置 IPtables

    2021-08-11 1. 前言 防火墙其实就是实现 Linux 下访问控制功能的,分为硬件和软件的防火墙两种类型.无论在何网络中,防火墙工作的地方一定是网络的边缘.防火墙的策略.规则就是去定义防火墙 ...

  7. linux centos7 tomcat8 配置成服务启动

    1. tomact 解压到/usr/local/tomcat下 2.vim /usr/local/tomcat/bin/catalina.sh 在OS specific support.前加上 (注意 ...

  8. Linux(Centos7.X ) 配置Java 环境变量

    前提条件:上传Jdk 文件到Linux服务器上. tar -zxvf jdk-8u111-linux-x64.tar.gz 修改 /etc/profile 在打开的文件末尾添加如下内容: export ...

  9. Linux centos7.0 配置防火墙及开放端口

    现在防火墙有两种服务1.service firewalld 2.service iptables 一.就firewalld来说查看开放的端口  netstat  -anp 查询防火墙状态  servi ...

随机推荐

  1. rdd的元素打印

    在集群上运行spark程序时,rdd的操作都在worker机上,因此输出rdd的元素将在worker机的标准输出上进行,驱动节点上不会运行,故直接才程序中写如下代码 rdd.foreach(print ...

  2. C#关于DateTime得到的当前时间的格式和用法

    DateTime.Now.ToShortTimeString() DateTime dt = DateTime.Now; dt.ToString();//2005-11-5 13:21:25 dt.T ...

  3. 【Leetcode_easy】643. Maximum Average Subarray I

    problem 643. Maximum Average Subarray I 题意:一定长度的子数组的最大平均值. solution1:计算子数组之后的常用方法是建立累加数组,然后再计算任意一定长度 ...

  4. Ubuntu-18.04更改安装源为国内源

    环境查看 修改源文件 /etc/apt/sources.list 备份配置文件后把文件内容替换如下 deb http://mirrors.aliyun.com/ubuntu/ bionic main ...

  5. Spring 多对对实体

    package com.wangshenghua.entity; import java.io.Serializable; import java.util.Set; import javax.per ...

  6. 初始mysql

    数据库操作 查看当前登陆用户: select user(); 登录数据库 mysql -u用户名 -p密码 -h 连接地址 修改当前用用户密码 set password = password('123 ...

  7. 学习笔记:oracle学习三:SQL语言基础之检索数据:简单查询、筛选查询

    目录 1. 检索数据 1.1 简单查询 1.1.1 检索所有列 1.1.2 检索指定的列 1.1.3 查询日期列 1.1.4 带有表达式的select语句 1.1.5 为列指定别名 1.1.6 显示不 ...

  8. centos 防火墙相关命令

    防火墙关闭: systemctl stop firewalld systemctl disable firewalld 重启防火墙: systemctl enable firewalld system ...

  9. TypeScript 类型推导及类型兼容性

    类型推导就是在没有明确指出类型的地方,TypeScript编译器会自己去推测出当前变量的类型. 例如下面的例子: let a = 1; 我们并没有明确指明a的类型,所以编译器通过结果反向推断变量a的类 ...

  10. Spring Boot系列教程十三:Spring boot集成Sentinel Redis

    前言 上一篇文章介绍了spring boot集成单点的redis,然而实际生产环境使用单点的redis风险很高,一旦宕机整个服务将无法使用,这篇文章介绍如何使用基于sentinel的redis高可用方 ...