Error creating/updating vhost file when updating reverse proxy url #162

Closed
opened 2026-04-05 20:25:38 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @e77 on 11/19/2024

CloudPanel version(s) affected

2.4.2

Description

when trying to update the reverse proxy url via the UI the following error is displayed:

An error has occurred, error message: nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/sites-enabled/stock.echo77.com.conf:19 nginx: configuration file /etc/nginx/nginx.conf test failed

Removing lies 14 and 15

if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;

results in the following error

Vhost is not valid, error message: nginx: [emerg] "location" directive is not allowed here in /etc/nginx/sites-enabled/stock.echo77.com.conf:15 nginx: configuration file /etc/nginx/nginx.conf test failed

incidentally the reverse proxy didn't work anyway - presumably because the url isn't in the vhost file as expected, and it can't be done with regex, so nginx doesn't know where to pass the traffic to.

Eitherway, the vhost file doesn't appear to be created correctly when setting up a reverse proxy.

How to reproduce

Update an existing reverse proxy url (which doesnt work anyway....) via the UI or by tring to edit row 19 of the vhost file via the UI.

Possible Solution

No response

Additional Context

No response

*Originally created by @e77 on 11/19/2024* ### CloudPanel version(s) affected 2.4.2 ### Description when trying to update the reverse proxy url via the UI the following error is displayed: > An error has occurred, error message: nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/sites-enabled/stock.echo77.com.conf:19 nginx: configuration file /etc/nginx/nginx.conf test failed Removing lies 14 and 15 >if ($scheme != "https") { rewrite ^ https://$host$uri permanent; results in the following error >Vhost is not valid, error message: nginx: [emerg] "location" directive is not allowed here in /etc/nginx/sites-enabled/stock.echo77.com.conf:15 nginx: configuration file /etc/nginx/nginx.conf test failed incidentally the reverse proxy didn't work anyway - presumably because the url isn't in the vhost file as expected, and it can't be done with regex, so nginx doesn't know where to pass the traffic to. Eitherway, the vhost file doesn't appear to be created correctly when setting up a reverse proxy. ### How to reproduce Update an existing reverse proxy url (which doesnt work anyway....) via the UI or by tring to edit row 19 of the vhost file via the UI. ### Possible Solution _No response_ ### Additional Context _No response_
Sign in to join this conversation.