-2

I have 2 webservices installed on my mailserver.

  • Roundcube /var/www/roundcube
  • Mail Admin Tool /var/www/mailAdmin (for postfix, dovecot configuration)

Additionally the Apache2 of the mailserver is hidden behind a nginx reverse proxy.

My question is, how do i configure Apache to map all http://mail.example.org/ request to my /var/www/roundcube folder and all http://mail.example.org/mailadmin requests to the /var/www/mailAdmin folder.

I wrote the following configuration. But the problem with this is that every request is mapped to /var/www/roundcube and if i request http://mail.example.org/webadmin Apache tries to access /var/www/roundcube/mailadmin.

I could do a ln -s at this point but this doesn't feel right or is it?

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName example.org
        ServerAlias mail.example.org
        DocumentRoot /var/www/roundcube/

        <Directory />
                Options FollowSymLinks
                AllowOverride Nonedevcontrol
        </Directory>

        <Directory /var/www/roundcube>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

The configuration of the reverse proxy is:

server{
    listen       80;
    server_name  mail.exampole.org;
    rewrite ^ https://mail.example.org$request_uri? permanent;
}

server {
    listen       443;
    server_name  mail.example.org;

    access_log  /var/log/nginx/access.mail.log;
    error_log /var/log/nginx/error.mail.log;

    ###SSL###
    include w.example.org.conf;


    # proxy to Apache 2 and mod_python
    location / {
        proxy_pass         http://192.168.1.200:80/;
        proxy_redirect     off;

        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_max_temp_file_size 0;

        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;
    }
}
Harrys Kavan
  • 402
  • 1
  • 5
  • 19
  • 2
    Can you work through your question and make things consistent please. You seem to be using `example.org` and `devcontrol.org` interchangeably. Also when you say `/var/www/roundcube` do you really mean `/var/www/roundcubemail` ? Similarly this `/var/www/roundcube/mailadmin` doesn't seem to make any sense in respect of other things in your question/config. – user9517 May 29 '14 at 11:41
  • I went through the text to make sure its more consistent. `/var/www/roundcube/mailadmin` is the problem that i have. I shouldn't be that way. But because of my configuration the base url of is set to /var/www/roundcube. So my request: http://mail.example.org/mailadmin resolves into `/var/www/roundcube/mailadmin` – Harrys Kavan May 29 '14 at 12:01

1 Answers1

2

You could try an alias, an alias maps a url to a filesystem location.

alias /mailadmin /var/www/roundcube/mailadmin

Although an aliasmatch may be useful too.

user9517
  • 115,471
  • 20
  • 215
  • 297