mirror of
https://github.com/caddyserver/caddy.git
synced 2025-07-09 03:04:57 -04:00
Add php_fastcgi docs
parent
52a2635eb5
commit
c85da3901a
@ -37,6 +37,7 @@ Features which are available in Caddy Enterprise are indicated with 🏢
|
|||||||
- [file_server](#file_server)
|
- [file_server](#file_server)
|
||||||
- [encode](#encode)
|
- [encode](#encode)
|
||||||
- [headers](#headers)
|
- [headers](#headers)
|
||||||
|
- [php_fastcgi](#php_fastcgi)
|
||||||
- [reverse_proxy](#reverse_proxy)
|
- [reverse_proxy](#reverse_proxy)
|
||||||
- [redir](#redir)
|
- [redir](#redir)
|
||||||
- [rewrite](#rewrite)
|
- [rewrite](#rewrite)
|
||||||
@ -520,6 +521,37 @@ headers [<matcher>] [[+|-]<field> <value>] {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### php_fastcgi
|
||||||
|
|
||||||
|
Proxies requests to one or more FastCGI backends specially configured for PHP apps. It has the same syntax and options as [reverse_proxy](#reverse_proxy), but is shorthand for a configuration equivalent to this example:
|
||||||
|
|
||||||
|
```
|
||||||
|
# internally rewrite URIs to match index.php files
|
||||||
|
matcher indexFiles {
|
||||||
|
file {
|
||||||
|
try_files {path} index.php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rewrite match:indexFiles {http.matchers.file.relative}
|
||||||
|
|
||||||
|
# proxy any requests for PHP files to backend via FastCGI
|
||||||
|
matcher phpFiles {
|
||||||
|
path *.php
|
||||||
|
}
|
||||||
|
reverse_proxy match:phpFiles php-fpm:9000 {
|
||||||
|
transport fastcgi {
|
||||||
|
split .php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Thus, the following single line is sufficient and works for _most_ PHP scripts (replace php-fpm:9000 with your php-fpm listener):
|
||||||
|
|
||||||
|
```
|
||||||
|
php_fastcgi php-fpm:9000
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
##### reverse_proxy
|
##### reverse_proxy
|
||||||
|
|
||||||
Proxies requests to one or more backends with configurable transport options.
|
Proxies requests to one or more backends with configurable transport options.
|
||||||
@ -580,6 +612,8 @@ transport fastcgi {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For proxying to PHP via FastCGI (php-fpm) specifically, see the [php_fastcgi](#php_fastcgi) directive.
|
||||||
|
|
||||||
##### redir
|
##### redir
|
||||||
|
|
||||||
Issue an HTTP redirect.
|
Issue an HTTP redirect.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user