Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If I have multiple subdomains in an Apache vhost file, and they all have the same ServerAdmin, can I put the ServerAdmin directive once at the top outside of the VirtualHost tags? I also have multiple domains each with their own file in /etc/apache2/sites-available.

So instead of this

<VirtualHost *:80>
   ServerAdmin     EMAIL
   DocumentRoot    /PATH/TO/WEB/FILES
   ServerName      SERVERNAME1
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin     EMAIL
   DocumentRoot    /PATH/TO/WEB/FILES
   ServerName      SERVERNAME2
</VirtualHost>

can I do this?

ServerAdmin     EMAIL

<VirtualHost *:80>
   DocumentRoot    /PATH/TO/WEB/FILES
   ServerName      SERVERNAME1
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot    /PATH/TO/WEB/FILES
   ServerName      SERVERNAME2
</VirtualHost>
share|improve this question
    
Will there be another server-wide ServerAdmin setting, or just one? –  Shane Madden Mar 3 '12 at 2:16
    
I also have multiple domains each with their own file in /etc/apache2/sites-available. Are you asking if I plan to repeat this pattern in those other files? –  David Xia Mar 3 '12 at 2:22
add comment

1 Answer

The ServerAdmin directive can be set in the server context, but only one (the last one to load, I think?) will be inheriting down to vhosts - so this will work if you do it once, and fail if you do it twice.

Maybe look into other options, like a shared Include file in each vhost definition?

share|improve this answer
    
So the 2nd code block I have in my question will work? –  David Xia Mar 3 '12 at 2:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.