1. The problem I’m having:
I’m new to caddy. I have Java, NodeJS & PHP application running on a domain. A NodeJS application running on port:80 which is working fine. but the resources of all the other applications are redirected with 302 to port:80 NodeJS application.
Caddy version:
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
4. How I installed and ran Caddy:
I follow this links to install caddy
a. System environment:
Debian 11
Command:
caddy start
caddy stop
My complete Caddy config:
:80 {
reverse_proxy localhost:3002
handle_path /v1/api/* {
root * /var/www/html/api/public
file_server
encode zstd gzip
php_fastcgi unix//run/php/php8.2-fpm.sock
}
handle_path /v1/* {
root * /var/www/html/v1/prod
file_server
}
handle_path /admin/* {
root * /var/www/html/admin
file_server
}
handle_path /lot1/* {
reverse_proxy localhost:9001
}
handle_path /lot2/* {
reverse_proxy localhost:9002
}
handle_path /ws/* {
reverse_proxy localhost:3005
file_server
# this a websocket apps
}
handle_path /ps/* {
root * /var/www/html/some_php_scripts
encode zstd gzip
php_fastcgi unix//run/php/php8.2-fpm.sock {
try_files {path} {path}/index.php =404
}
file_server
}
handle_path /backend/* {
reverse_proxy ip:8080
}
log {
output file /var/log/caddy/access.log {
roll_size 3MiB
roll_keep 5
roll_keep_for 48h
}
format console
}
}