Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to index.html or index.php #23

Closed
MisterDuval opened this issue Apr 29, 2015 · 12 comments
Closed

Default to index.html or index.php #23

MisterDuval opened this issue Apr 29, 2015 · 12 comments

Comments

@MisterDuval
Copy link

Can't find this in documentation, there is no default index file like index.html.
The php preset for fastcgi index index.php isn't working, at least on Windows x86.

Thanks for this very nice project :)

@abiosoft
Copy link

I got it to work. Ensure php-fpm has started.

My Caddyfile looks like this

127.0.0.1 

root /path/to/php/dir

fastcgi / 127.0.0.1:9000 php {
    ext .php
    index index.php index.html
}

Hope this helps.

@MisterDuval
Copy link
Author

Thanks Abiola, this is not working with Caddy Win x86, it outputs this error:
http: multiple response.WriteHeader calls

@mholt
Copy link
Member

mholt commented Apr 29, 2015

That's interesting @devil1591. It means that more than one middleware thinks it has the floor. In other words, either:

  • one middleware that actually writes the response isn't telling others properly (via return value, maybe?) that it wrote to the response, or
  • a middleware that was told that somebody else wrote to the response still wrote to the response when it shouldn't have.

What kind of response was the client seeing? An error, or a page successfully served?

@MisterDuval
Copy link
Author

The error is No input file specified. 404 Not Found

@mholt
Copy link
Member

mholt commented Apr 29, 2015

Do you have Go installed? Could you change line 119 of fastcgi.go to:

return 0, nil

Because I suspect that php-fpm is giving 404 and writing "No input file specified" but the fastcgi handler is incorrectly returning the 404, signaling to Caddy that it needs to handle the error by writing "404 Not Found" - in this case, Caddy should not add anything to the response...

(If you don't have Go, just let me know, I can whip up a binary for you real quick.)

@abiosoft
Copy link

@devil1591 what is your middleware stack ? It could probably be a bug not limited to windows.

@MisterDuval
Copy link
Author

@mholt sorry, I don't have Go installed.
@abiosoft, I'm using php-cgi.exe (v5.4.40)

@mholt
Copy link
Member

mholt commented Apr 29, 2015

@devil1591 No problem. Here's a modified binary. I wouldn't expect it to fix the index file issue, but it should no longer say "multiple response.WriteHeader calls" - can you confirm that?

@MisterDuval
Copy link
Author

That's right, the error is now No input file specified. and there is no error on the console anymore. The index issue is still there.

@MisterDuval MisterDuval changed the title Default to index.html / index.php Default to index.html or index.php Apr 30, 2015
@mholt
Copy link
Member

mholt commented Apr 30, 2015

Awesome - 1 down, 1 to go.

@devil1591 Now I need some more details. Could you paste the contents of your Caddyfile? And also the URL exactly as it appears in your browser when that message appears? I need to make sure it ends with a forward slash / character.

@mholt mholt added the in progress 🏃‍♂️ Being actively worked on label May 2, 2015
@MisterDuval
Copy link
Author

I confirm that Caddy 0.5.1 fixes the index file issue.
My URL was entered with a trailing slash.
Here is my caddy.conf:

192.168.10.66:80, 0.0.0.0:80
gzip
log logs/access.log
root apache2/htdocs
fastcgi / 127.0.0.1:9123 php {
    ext .php
    index index.php index.html
}

I used both 0.0.0.0 and 192.168.10.66 because 0.0.0.0 wasn't working.

@abiosoft
Copy link

abiosoft commented May 4, 2015

@devil1591 glad to hear that. The are few new improvements to FastCGI middleware coming in the next release. Stay tuned.

@mholt mholt removed the in progress 🏃‍♂️ Being actively worked on label May 4, 2015
@mholt mholt closed this as completed May 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants