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.

I have a domain: example.com. There’s also a subdomain, admin.example.com:

<VirtualHost *:80>
    ServerName admin.example.com
    ServerAlias admin
</VirtualHost>

Now I want to make postfixadmin control panel available at admin.example.com/postfix. The default config in /etc/apache2/conf.d/postfixadmin is:

Alias /postfixadmin /usr/share/postfixadmin

How should I change it? What I want is something like:

Alias admin/postfix /usr/share/postfixadmin

Edit: I know that I can just create a symlink under document root, pointing to /usr/share/postfixadmin, but I’m looking for a solution through the means of Apache config.

share|improve this question

2 Answers 2

There are probably multiple ways to accomplish this. To ways I can think of:

Symlink

You could set a document root for the admin VirtualHost and then create a postfixadmin symlink to /usr/share/postfixadmin. Something like:

<VirtualHost *:80>
    ServerName admin.example.com
    ServerAlias admin
    DocumentRoot /var/www/admin

    <Directory /var/www/admin>
        Options +FollowSymLinks
    </Directory>
</VirtualHost>

Directory Security

Keeping the original alias, you could set some diretory security per virtual hosts to only allow the admin virtual host to access the directory. Something like:

Admin VirtualHost

<VirtualHost *:80>
    ServerName admin.example.com
    ServerAlias admin

    <Directory /usr/share/postfixadmin>
        Order Deny,Allow
        Allow from All
    </Directory>
</VirtualHost>

Main VirtualHost

<VirtualHost *:80>
    ServerName example.com

    <Directory /usr/share/postfixadmin>
        Order Deny,Allow
        Deny from All
    </Directory>
</VirtualHost>
share|improve this answer

Leave the original virtualhost definition the way it is and place a directory inside your document root entitled "postfix". Put the postfixadmin files in there. This will then render under your requested admin.example.com/postfix

share|improve this answer

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.