質問

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 myemail@gmail.com
    ServerName testsite.example.com
    DocumentRoot /var/www/example.com/www
</VirtualHost>
役に立ちましたか?

解決

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.

他のヒント

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 foo@example.com
ServerSignature email

Relevant documentation:

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

Then remember to restart your Apache HTTPd server.

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top