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

feat(caddy): a command to start a PHP server #238

Merged
merged 9 commits into from
Oct 5, 2023
Merged

Conversation

dunglas
Copy link
Owner

@dunglas dunglas commented Oct 3, 2023

Run ./frankenphp php-server to serve PHP in the local directory with a production-grade server!

cc @mholt @francislavoie

Copy link
Contributor

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall 👍

caddy/command.go Show resolved Hide resolved
caddy/command.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome 🕺 I approve and second Francis' comments!

@dunglas
Copy link
Owner Author

dunglas commented Oct 4, 2023

I added a new --compress option to enable compression.

@francislavoie
Copy link
Contributor

Should it maybe be enabled by default? Maybe --compress-off instead 🤔

@dunglas
Copy link
Owner Author

dunglas commented Oct 4, 2023

@francislavoie maybe should we choose if we want something "edge-ready" (and so, maybe should we also enable HTTPS by default, but then it will not be consistent with file-server) or something that will be put behind a proxy.

Currently, the commands mimic the behavior of file-server (no HTTPS by default), so I disabled compression by default. But I don't know the reasons why file-server doesn't use HTTPS by default.

@francislavoie
Copy link
Contributor

francislavoie commented Oct 4, 2023

"HTTPS by default" is only possible when a domain is specified anyway. That's how it works in the Caddyfile too. That's a key input that's required, since a name is needed for the SAN in the TLS cert (unless you use On-Demand TLS, but that's besides the point)

@mholt
Copy link
Contributor

mholt commented Oct 4, 2023

The caddy file-server command will use HTTPS if the --domain flag is specified with a domain name.

The caddy reverse-proxy command uses HTTPS if the --from value contains a domain name.

Maybe FrankenPHP could work similarly.

@dunglas
Copy link
Owner Author

dunglas commented Oct 4, 2023

@mholt it currently does, but yes let's enable compression by default then!

@francislavoie
Copy link
Contributor

(We should probably update caddy file-server to do the same; mostly an oversight I think that it didn't)

@dunglas
Copy link
Owner Author

dunglas commented Oct 4, 2023

I'll open a PR on Caddy.

caddy/command.go Outdated Show resolved Hide resolved
@dunglas dunglas merged commit c624971 into main Oct 5, 2023
29 checks passed
@dunglas dunglas deleted the feat/php-server branch October 5, 2023 12:56
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

Successfully merging this pull request may close these issues.

3 participants