Convert Nginx to Caddy

How can I adapt the following Nginx config with Caddy in Docker:

server {
    root /var/www/public; 
    index index.php;
    server_name darkrate.com www.darkrate.com;

    location /ws/ {
        proxy_pass http://212.162.152.250:8081/ws/;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /es {
        proxy_pass http://127.0.0.1:8088/es;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        proxy_read_timeout 86400;

        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /phantom {
        proxy_pass http://127.0.0.1:8083;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

location /exchange/ {
        rewrite ^/exchange/(.*)$ /$1 redirect;
#        add_header Cache-Control "max-age=31536000, public, s-maxage=31536000";
}

location /exchanger/ {
        rewrite ^/exchanger/(.*)$ /exchangers/$1 redirect;
#        add_header Cache-Control "max-age=31536000, public, s-maxage=31536000";
}

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        add_header Cache-Control "max-age=31536000, public, s-maxage=31536000";

        rewrite ^/(.*)/$ /$1 permanent;
    }

    location /admin {
        alias /var/www/public/;
        try_files $uri $uri/ @admin;

        add_header Cache-Control "max-age=31536000, public, s-maxage=31536000";

        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_pass php-fpm:9000;
        }
    }

    location @admin {
        rewrite /admin/(.*)$ /admin/index.php?/$1 last;
    }

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass php-fpm:9000;
    }

    location ~ /\.ht {
            deny all;
    }

    if ($host = www.darkrate.com) {
        return 301 https://darkrate.com$request_uri;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/darkrate.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/darkrate.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = www.darkrate.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = darkrate.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name darkrate.com www.darkrate.com;
    listen 80;
    return 404; # managed by Certbot




}

Fastcgi snippets:

# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;

# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;

# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;

fastcgi_index index.php;
include fastcgi.conf;

Caddy version: v2.7.6
Docker version: 24.0.5