index of displays apache and php version information
伊谢尔伦
伊谢尔伦 2017-05-16 16:58:42
0
2
814

Masters, show the apache and php version information in the red box in the picture, which configuration item apache is

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
習慣沉默

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 beforeServerSignatureServerTokens

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 ServerSignatureServerTokens 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

ReadmeNameHeaderName It may already exist, then change it.

Then create README.php

in the root directory of your website (the directory corresponding to your.domain.com/)

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版本号的话应该没有限制,可以不动ServerTokensconfiguration 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

洪涛

This mainly involves two configurations ServerSignatureServerTokens , 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)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template