想法是这样的:
*.localhost:80 {
root /var/www/{hostonly}/public
fastcgi / php-fpm:9000 php {
index index.php
}
rewrite {
to {path} {path}/ /index.php?{query}
}
gzip
browse
log stdout
errors stdout
log / stdout {hostonly}
}
但是终端输出:
caddy_1 | 18/Jan/2018:09:43:51 +0000 [ERROR 0 /index.php] Primary script unknown
caddy_1 | 172.20.0.1 - - [18/Jan/2018:09:43:51 +0000] "GET /index.php HTTP/1.1" 404 40
caddy_1 | xxx.localhost
当然 /var/www/xxx.localhost/pulbic/index.php 其实是存在的。
1
bigxu OP caddyserver
|
2
bigxu OP |
3
KgM4gLtF0shViDH3 2018-01-18 20:54:04 +08:00 via Android
go 写的那个 server ?
|
4
bigxu OP 这样调试多个项目,就不用为每个项目更改 Caddyfile,并且重启了。
``` *.localhost:80 { root /var/www/ fastcgi / php-fpm:9000 php { index index.php } rewrite { to /{hostonly}/public/{path} /{hostonly}/public/{path}/ /{hostonly}/public/index.php?{query} } gzip browse log stdout errors stdout log /var/log/caddy/{hostonly}.access.log errors /var/log/caddy/{hostonly}.error.log } ``` |