Commit eb1b22f
authored
fix: replacing php port for isolation also replaced all non-php ports (#36)
A follow-up to PR #33 which introduced a bug that replaced **all**
ports, not just the php-specific ones. So this meant that port 60, 80,
etc. was all replaced which crashed nginx preventing it from obtaining
and running the sites.
---
This pull request introduces significant improvements to how Nginx site
configurations handle PHP port overrides in Valet, along with a more
robust upgrade process for deprecated Nginx directives. The changes
ensure per-site PHP port flexibility, automate config upgrades, and
enhance maintainability.
**Nginx Site Configuration and PHP Port Handling:**
* Updated the Nginx config stubs (`secure.valet.conf` and
`unsecure.valet.conf`) to use a new variable `valet_site_php_port`
instead of directly referencing `valet_php_port`, allowing for per-site
PHP port overrides.
* Refactored the `replacePhpVersionInSiteConf` method in `Site.php` to
support replacing the PHP port with either a specific value or the
global variable, and improved the removal of isolated PHP version
comments.
**Upgrade and Migration Automation:**
* Added a new upgrade routine in `Upgrader.php` that scans all Nginx
site configs and upgrades them to use the new per-site PHP port override
format, ensuring this runs only once per install.
* Introduced a mechanism to track which sites have had their Nginx
configs upgraded during a run to avoid redundant operations.
**Deprecated Directive Handling:**
* Replaced the previous inline upgrade logic with a new process that
detects deprecated Nginx directives (`http2` and `http2_push_preload`),
warns the user, and upgrades affected site configs automatically.
These changes collectively modernize Valet’s Nginx configuration
management, making it more flexible and future-proof.
~ Summary generated by Copilot. For more detailed info, view the commit
messages.4 files changed
Lines changed: 158 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
976 | 976 | | |
977 | 977 | | |
978 | 978 | | |
| 979 | + | |
979 | 980 | | |
980 | 981 | | |
981 | 982 | | |
982 | 983 | | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | 984 | | |
987 | | - | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
988 | 999 | | |
989 | 1000 | | |
990 | 1001 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
36 | | - | |
37 | | - | |
| 43 | + | |
38 | 44 | | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
119 | | - | |
120 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
121 | 179 | | |
122 | | - | |
| 180 | + | |
123 | 181 | | |
124 | 182 | | |
125 | 183 | | |
126 | 184 | | |
127 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
128 | 189 | | |
129 | 190 | | |
130 | 191 | | |
| 192 | + | |
| 193 | + | |
131 | 194 | | |
132 | 195 | | |
133 | 196 | | |
| |||
139 | 202 | | |
140 | 203 | | |
141 | 204 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
171 | 209 | | |
172 | 210 | | |
173 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
174 | 222 | | |
175 | 223 | | |
176 | 224 | | |
| |||
202 | 250 | | |
203 | 251 | | |
204 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
205 | 307 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | | - | |
| 105 | + | |
| 106 | + | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
0 commit comments