Bad gateway when GET /

explain what you are trying to do

I want Caddy to display my index page when I GET /.
In other words, when I go to caddyexample.com, I want to see my index.php. Currently, I get a bad gateway.

show what you have already tried

I have tried setting index to index.php in /etc/caddy/Caddyfile.

include error messages and log output

I get a bad gateway when I GET /.

This is my Caddyfile:;

http:// {
    root /var/www/html
    gzip
    fastcgi / 127.0.0.1:9000 php
    ext .php
    index index.php
}

Hi @NominaSumpta, welcome to the Caddy community.

Do any other paths function correctly?


P.S. I note that ext and index are essentially without function for your setup - a request for a PHP file or an index will always be handled by fastcgi, which will serve the client without regard to whatever you set those to.

Thank you for responding.

Do any other paths function correctly?

Yes. Due to the ext parameter, when I go to an actual page such as producten, the page gets loaded just fine. When I visit a non-existent page, I get a 404 from Caddy.

P.S. I note that ext and index are essentially without function for your setup - a request for a PHP file or an index will always be handled by fastcgi , which will serve the client without regard to whatever you set those to.

ext is not without function. It does make a difference and does what the documentation says it does.

index seems to be without function.

I couldn’t replicate the issue with Caddy 0.11.0 on macOS 10.13.6.

:2015 {
  root /Users/whitestrake/Projects/test
  gzip
  fastcgi / :9000 php
  ext .php
  index index.php
}

And some quick testing:

whitestrake at apollo in ~/Projects/test
❯ cat index.php
<?php echo("This is the PHP index file.") ?>

whitestrake at apollo in ~/Projects/test
❯ cat foo.php
<?php echo("This is the PHP foo file.") ?>

whitestrake at apollo in ~/Projects/test
❯ curl http://localhost:2015/
This is the PHP index file.⏎

whitestrake at apollo in ~/Projects/test
❯ curl http://localhost:2015/foo
This is the PHP foo file.⏎

This is very strange. The issue seems to have fixed itself overnight…

Investigating.

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