Closed ghost closed 4 years ago
Whatever php
is, it needs a port -- the server doesn't know what port to dial if it only has a hostname. You need something like php:5000
or whatever.
Edit: Huh, only half my reply got in... weird.
As for this:
Port 9000 is open in UFW so I dont know what is causing the connection refused on that.
I don't know what's causing the connection to be refused either, you'll have to debug that on your system. This should be obvious, but make sure php-fpm is listening at that address.
so php_fastcgi / unix//var/run/php/php7.3-fpm.sock php should be php_fastcgi / unix//var/run/php/php7.3-fpm.sock php:9000 (or whatever) ?
Why is php
on the end there? Are you emulating the old v1 fastcgi
PHP preset?
I note that there is no such preset in v2, the syntax only calls for two parameters - a matcher and the upstream server: https://caddyserver.com/docs/caddyfile/directives/php_fastcgi
Therefore, php
here is being interpreted as a second upstream. If you have a second upstream located at php:9000
, then yes, it should be php:9000
. If you're just carrying over the preset from v1, drop it entirely; just use php_fastcgi / unix//var/run/php/php7.3-fpm.sock
.
P.S. re: connection refused - it could occur for an open port that no program is currently listening on, the operating system is the one issuing a refusal in this case. If you've got PHP-FPM listening on the socket, did you disable the port 9000 listener maybe? Just something to double check, although hopefully unnecessary if you get the socket working.
Why is
php
on the end there? Are you emulating the old v1fastcgi
PHP preset?I note that there is no such preset in v2, the syntax only calls for two parameters - a matcher and the upstream server: https://caddyserver.com/docs/caddyfile/directives/php_fastcgi
Therefore,
php
here is being interpreted as a second upstream. If you have a second upstream located atphp:9000
, then yes, it should bephp:9000
. If you're just carrying over the preset from v1, drop it entirely; just usephp_fastcgi / unix//var/run/php/php7.3-fpm.sock
.
im getting conflicting info about how to get php to work in caddy. i want to use caddy2 but i cant tell whats caddy1 and whats caddy2.
Huge amounts of threads on the community forums relate to v1 because v2 is relatively very new. Assume that any thread that doesn't explicitly mention v2 is not applicable at all.
Here's the official home of Caddy v2 documentation: https://caddyserver.com/docs/
I have also linked the php_fastcgi
documentation in the comment you quoted.
Try that one with just the unix socket and no php
on the end and let us know if it works. Hopefully you should be up and running with just that.
@dogpatchmedia
im getting conflicting info about how to get php to work in caddy. i want to use caddy2 but i cant tell whats caddy1 and whats caddy2 in the documentation
By default, the docs are for Caddy 2 now. Just look at the big banners at the top of each page:
I don't think that's very difficult... also v1 docs have /v1/
in the URL.
since the actual docs suck pretty bad are are just the most basic of basic.
You can help improve them instead of complaining that they "suck pretty bad", you know. The docs are open source: https://github.com/caddyserver/website
Thank you, @whitestrake, for helping!
VERSION:
v2.0.0-beta.13 h1:QL0JAepFvLVtOatABqniuDRQ4HmtvWuuSWZW24qVVtk=
CONFIG:
PROBLEM:
I can't get PHP-FPM to work. I get errors either way I try and configure it. Port 9000 is open in UFW so I dont know what is causing the connection refused on that. The first error cause a 500 and the second causes a 502.
I'd like to use the socket not the port since its on the same machine.
Ive read pretty much every post about PHP-FPM and Caddy2 and none of it is working for me.