Caddy 2 and Symfony

1. Caddy version (caddy version):

v2.3.0

2. How I run Caddy:

Basically, with the command line. It has been installed with apt.

a. System environment:

I am on Debian 8.11 (Jessie).

d. My complete Caddyfile or JSON config:

xxxxxxxxxx.com {
        log
        root * /xxxxxxx/xxxxxx/public
        php_fastcgi unix//run/php/php7.0-fpm.sock
        encode gzip zstd
}

3. The problem I’m having:

Hello !

I am having exactly the same problem as this ticket : https://caddy.community/t/caddy2-symfony/6978.

I do not understand why, but my Symfony website is a white page. Every page I try to launch is a white blank page. Does anyone knows why ? I really have the same problem as this ticket…

5. What I already tried:

I have been searching for some working Caddyfiles for Symfony on Github and Google, and tried them, but they didn’t worked.

Also, if I add file_server in the configuration, like in some others Caddyfiles, I got a 404 error.
And if I remove zstd, it doesn’t change anything.

For your information, Symfony is in version 4.4.

Thanks by advance for the help !Preformatted text

The blank page is typically because Caddy didn’t actually handle the request, and therefore serves an empty 200 response. This is because you didn’t have a file_server directive, so it falls through.

If you get a 404 when you add file_server, then it’s probably because Caddy couldn’t read your files. When running as a systemd service, Caddy runs as the caddy user, so you need to make sure that user has permissions to see your site’s files.

I’d strongly recommend upgrading to a newer version of PHP. Version 7.0 has no longer been supported for over two years now:

https://www.php.net/supported-versions.php

1 Like

Thank you @francislavoie !

This helped me a lot. The caddy user could not read my files, that was why I did not see anything when I added file_server. And thanks for the explanation for why I needed to add file_server !

And for the PHP version, yes, don’t worry : I was just testing Caddy on an old machine that is no longer up to date, to understand the configurations, etc. Then I will test it in preprod, where all my versions are up to date :slight_smile: Then in prod, where everything is up to date too. I was just lazy to update PHP on this old test machine that doesn’t support the latest PHP versions :wink:

Thanks a lot for the help !! :slight_smile:

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.