Httpd服务入门知识-Httpd服务常见配置案例之显示服务器版本信息
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.httpd配置文件的组成
1>.主要组成
Global Environment
Main server configuration
virtual host
2>.配置格式:directive value(指令 属性值)
directive 不区分字符大小写
value 为路径时,是否区分大小写,取决于文件系统
3>.官方帮助
博主推荐阅读: http://httpd.apache.org/docs/2.4/
二.显示服务器版本信息
1>.如下图所示,默认情况下服务器版本是显示的
2>.点击指令快速参考(如下图所示,点击"Run-time Configuration Directives")
3>.快速过滤我们要查找的指令(如下图所示,咱们要设置的是显示服务器版本信息,该指令是以"S"开头的)
4>.如下图所示,点击"ServerTokens"指令
5>.查看显示服务器版本信息案例
6>.自定义httpd的配置文件,设置参数"ServerTokens Prod"
[root@node101.yinzhengjie.org.cn ~]# egrep -v "^ *#|^$" /etc/httpd/conf/httpd.conf ServerRoot "/etc/httpd" Listen 80 Include conf.modules.d/*.conf User apache Group apache ServerAdmin root@localhost <Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "/var/www/html" <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> 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 </IfModule> EnableSendfile on IncludeOptional conf.d/*.conf [root@node101.yinzhengjie.org.cn ~]# [root@node101.yinzhengjie.org.cn ~]#