Caddy + PHP-FPM + Rocky 9, File Not Found

Hey there! I’m trying to set up a local dev server on my home network and installed Rocky Linux 9 onto a computer I had laying around. Here are the steps I’ve taken:

  • Installed Rocky 9
  • Installed PHP 8.2 from the remi repos
  • Configured PHP-FPM to use the user and group caddy and enabled the service
  • Installed Caddy from the COPR repos and enabled the service
  • Configured the address dk.local to point to my project directory and use the php_fastcgi according to the common patterns
  • Ensured the root certs were installed and Caddy was added to the wheel group
  • Moved PHP-FPM to port 9000 and configured Caddy to proxy to that port

Now, when I navigate to the address, the page will load but I get a “File not found” response, when I do in fact have an index.php in the directory I specified.

dk.local {
        root * /public/dk
        encode gzip
        php_fastcgi 127.0.0.1:9000
        file_server
}

The directory is owned caddy:caddy, as well as the index.php file within. Both Firefox and Edge give me a 404 response when requesting it.

Rocky is red-hat-like, right? Make sure you don’t have any SELinux rules blocking things.

See this guide for debugging possible SELinux problems:

1 Like

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