I’m trying to use caddy a new webserver for mail-in-a-box.
On the top domain there should be multiple paths (/mail, /admin, /cloud) directing to various services.
I don’t understand how to realize this with caddy. As an example, roundcube:
It’s php, lives at /usr/local/lib/roundcubemail/ and should be served under /mail.
My non-working caddy conf
root /home/user-data/www/default
# Roundcube Webmail configuration.
fastcgi /mail /var/run/php5-fpm.sock php {
# Not sure if this statement works..
root /usr/local/lib/roundcubemail
}
internal /mail/config
rewrite /mail {
r (.*)
to /usr/local/lib/roundcubemail/{path} /usr/local/lib/roundcubemail/{path}/ /usr/local/lib/roundcubemail/index.php?{query}
}
Original nginx roundcube webmail configuration.
rewrite ^/mail$ /mail/ redirect;
rewrite ^/mail/$ /mail/index.php;
location /mail/ {
index index.php;
alias /usr/local/lib/roundcubemail/;
}
location ~ /mail/config/.* {
# A ~-style location is needed to give this precedence over the next block.
return 403;
}
location ~ /mail/.*\.php {
# note: ~ has precendence over a regular location block
include fastcgi_params;
fastcgi_split_path_info ^/mail(/.*)()$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/lib/roundcubemail/$fastcgi_script_name;
fastcgi_pass php-fpm;
# Outgoing mail also goes through this endpoint, so increase the maximum
# file upload limit to match the corresponding Postfix limit.
client_max_body_size 128M;
}