Heyo, i have a email server using IRedMail. which by default, uses Nginx. the first chunk of the config is simple and can be ported, i just dont know the equivilant of Nginx’s include config for caddy
#Note: This file must be loaded before other virtual host config files,
#
# HTTPS
server {
listen 443;
server_name _;
root /var/www/html;
index index.php index.html;
include /etc/nginx/templates/misc.tmpl;
include /etc/nginx/templates/ssl.tmpl;
include /etc/nginx/templates/iredadmin.tmpl;
include /etc/nginx/templates/roundcube.tmpl;
include /etc/nginx/templates/sogo.tmpl;
include /etc/nginx/templates/netdata.tmpl;
include /etc/nginx/templates/php-catchall.tmpl;
}
Files nominated by include also need to be valid nginx configuration, so they will need to be translated as well while you’re converting to Caddyfile configuration.
Okay, what is the caddy equivilant of this?
# static files under /iredadmin/static
location ~ ^/iredadmin/static/(.*) {
alias /opt/www/iredadmin/static/$1;
}
About as often as there is a direct translation, there’s no direct translation but other ways to achieve the underlying goal of the configuration.
In this case, the configuration is set to have /iredadmin/static serve files from disk from /opt/www/iredadmin/static. You can do this in Caddy with another path-specific virtual host:
It’s not entirely the same - it doesn’t go within another block like nginx’s probably would, it stands on its own in the Caddyfile - but it should achieve the same purpose.
I’m getting a good response from that website - a HTTP 200 OK, with two Server: Caddy headers (indicating that there’s a Caddy proxying another Caddy currently).
i actually fixed it, appearntly, the index.php had some code that was redirecting to https, but i had the caddy server running on port 80. so it looped over and over, causing a redirect loop.