Masters, show the apache and php version information in the red box in the picture, which configuration item apache is
習慣沉默2017-05-16 17:00:42
The page you see directly displayed in the file directory is processed by Apache's mod_autoindex module.
Let’s talk about what others mentioned beforeServerSignature
和 ServerTokens
ServerTokens Full
ServerSignature On
mod_autoindex end information: Apache/2.4.10 (系统 Debian/Ubuntu/Windows之类的) OpenSSL/1.0.1t Server at your.domain.com Port 443
Http header: Server:Apache/2.4.10 (系统 Debian/Ubuntu/Windows之类的) OpenSSL/1.0.1t
ServerTokens Prod
ServerSignature Off
This is what it looks like:
mod_autoindex end information: Apache Server at your.domain.com Port 443
Http header: Server:Apache
So ServerSignature
和 ServerTokens
has nothing to do with your problem directly.
In other words, there is no configuration item for Apache that can directly solve this problem (Apache does not have to be combined with PHP, so why should someone show you PHP information by the way after installing Apache?).
Indirect solution: The solution I gave is Debian/Ubuntu system + mod_php. It is estimated that other systems will be similar.
/etc/apache2/mods_enabled/autoindex.conf
</IfModule>
Preceded by:
AddHandler application/x-httpd-php .php
AddType text/html .php
ReadmeName /README.php
HeaderName HEADER.html
ReadmeName
和 HeaderName
It may already exist, then change it.
Then create README.php
Content:
<?php
echo apache_get_version().', PHP Version:'.phpversion();
?>
Attention, here is the only possibility with ServerTokens
有关的内容,如果你配置的是 Prod
, 则只能显示出来Apache
, 如果配置的是 Full
which will display the large list of detailed information I mentioned before:
Apache/2.x.xx (系统 Debian/Ubuntu/Windows之类的) OpenSSL/1.0.xx
In addition, if you call shell_exec
获得Apache版本号的话应该没有限制,可以不动ServerTokens
configuration directly in php.
See more at:
Apache mod_autoindex Detailed description of Header and Readme
PHP function to get Apache version information
PHP Get PHP version information
Declare the Handler of .php before calling this PHP. Although you may have stated it elsewhere, this configuration file is processed first by Apache. So we need to declare in advance what the information displayed by different ServerTokens looks like
PHP中文网2017-05-16 17:00:42
This mainly involves two configurations ServerSignature
和 ServerTokens
, ServerSignature
起开关作用,ServerTokens
控制显示信息多少。
修改 httpd.conf
These two configurations are as follows, and they will be displayed after restarting.
ServerSignature On
ServerTokens Full
Attached are the related values of the two configurations
ServerSignature : Off | On | Email
ServerTokens: Prod | Major | Minor | Min | OS | Full (display content from small to large)