Eche un vistazo a InSpec, una herramienta que le permite "convertir sus requisitos de cumplimiento, seguridad y otras políticas en pruebas automatizadas".
https://www.inspec.io
Puede hacer todas las pruebas de configuración que necesita para su servidor Nginx. Aquí hay una forma de probar la existencia del archivo conf y el valor de server_tokens:
conf_path = '/etc/nginx/nginx.conf'
control 'Server tokens should be off' do
describe file(conf_path) do
it 'The config file should exist and be a file.' do
expect(subject).to(exist)
expect(subject).to(be_file)
end
end
if (File.exist?(conf_path))
Array(nginx_conf(conf_path).params['http']).each do |http|
describe "http:" do
it 'server_tokens should be off if found in the http context.' do
Array(http["server_tokens"]).each do |tokens|
expect(tokens).to(cmp 'off')
end
end
end
end
end
end
Si se configura correctamente, InSpec devuelve:
✔ Server tokens should be off: File /etc/nginx/nginx.conf
✔ File /etc/nginx/nginx.conf The config file should exist and be a file.
✔ http: server_tokens should be off if found in the http context.
Si no:
× Server tokens should be off: File /etc/nginx/nginx.conf (1 failed)
✔ File /etc/nginx/nginx.conf The config file should exist and be a file.
× http: server_tokens should be off if found in the http context.
expected: "off"
got: ["on"]
(compared using `cmp` matcher)
server_tokenno tiene nada que ver con la versión PHP. Por lo general, se envía en un encabezado separadoX-Powered-By. Supongo que necesitas php.net/manual/en/ini.core.php#ini.expose-php