Enrique Moreno Tent
Enrique Moreno Tent

Reputation: 25317

Benefits of ServerAdmin Directive in Apache2

How exactly can the ServerAdmin directive in Apache2 be useful?

The Apache2 documentation reads:

The ServerAdmin sets the contact address that the server includes in any error messages it returns to the client.

But whenever I get a 404 Error back, the email address set in my vhost is nowhere to be seen. Do I need some extra Directive to make it work?

vhost:

<VirtualHost *:8080>
    ServerAdmin [email protected]
    ServerName testsite.example.com
    DocumentRoot /var/www/example.com/www
</VirtualHost>

Upvotes: 28

Views: 22038

Answers (2)

Valerio Bozz
Valerio Bozz

Reputation: 1526

As default the ServerAdmin information is not displayed on error messages.

You can display this information enabling the ServerSignature directive to the EMail value:

ServerAdmin [email protected]
ServerSignature EMail

Note that the only allowed values for ServerSignature are: On, Off and EMail.

Relevant documentation:

https://httpd.apache.org/docs/current/mod/core.html#serveradmin

https://httpd.apache.org/docs/current/mod/core.html#serversignature

Then remember to restart your Apache HTTPd server:

systemctl restart apache2

NOTE: You can also use an URL, instead of an email. That's very useful if you have a contact page instead of an email address.

Upvotes: 2

Joe T
Joe T

Reputation: 2350

Apparently that functionality of Apache has been deprecated. I used to see a message in the event of an error to contact the server administrator, but now can't get it to happen on the current versions.

As an answer to your question "how can it be useful"; you can get the value with PHP at least $_SERVER['SERVER_ADMIN'] and return that from your code in the event of an error.

Upvotes: 27

Related Questions