-
Notifications
You must be signed in to change notification settings - Fork 702
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
handle deprecated http2_push_preload conf for nginx >= 1.25.1 #1451
Conversation
I agree that this is the correct fix. Unfortunately it only works if the Nginx version is 1.25.1 or greater, which is quite new. The changed syntax is not backward-compatible. (Ref: nginx docs )
If someone is using (or is forced to use) an older Nginx version, they will get the following anytime they run
@mattstauffer how do you feel about incorporating nginx-version-detection so we can handle version-specific stub file handling? |
@drbyte thank you for your response, I was thinking about that. Without a mayor version bump, probably a version check would be needed, since installing Valet requires the latest nginx version by default. I'll take a look and will update the PR. |
At least the old syntax is not throwing Fatal errors and preventing Nginx from starting. |
@drbyte true but fresh installs will require lates version of nginx so now it's broken as is.
my suggestion is to add a check in Site.php to check the nginx version and require I'll make a fix so you can check it. |
cli/Valet/Site.php
Outdated
@@ -631,8 +631,11 @@ public function buildCertificateConf(string $path, string $url): void | |||
public function buildSecureNginxServer(string $url, string $siteConf = null): string | |||
{ | |||
if ($siteConf === null) { | |||
$nginxVersion = ltrim(exec('nginx -v'), 'nginx version: nginx/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since ltrim()
technically doesn't support passing a "phrase" (it treats it as a bunch of characters, not a phrase), perhaps simply str_replace()
might be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thx. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OpJePl44tsm4n perhaps also rework the Title of this PR slightly to incorporate "http2" into it?
Maybe something like "handle deprecated http2_push_preload conf for nginx >= 1.25.1" ?
@mattstauffer @driesvints I think this is ready for merge. Of course, feel free to test on your local machine before+after upgrading nginx via |
version to string
@drbyte thank you so much for reviews and back-and-forths! Again, apologies for my delay here. @OpJePl44tsm4n thank you for this PR! Testing now, and will merge if it doesn't bonk things for me. |
Updated the config so it will work for fresh installs.
removed http2 and http2_push_preload because they are deprecated in latest Nginx versions.