mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 18:01:37 +00:00
Update the vhost file to name the backend after the domain (#485)
This commit is contained in:
parent
fd67097884
commit
75a4fde8de
@ -6,8 +6,12 @@
|
|||||||
}
|
}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@php
|
||||||
|
$backendName = preg_replace("/[^A-Za-z0-9 ]/", '', $site->domain).'_backend';
|
||||||
|
@endphp
|
||||||
|
|
||||||
@if ($site->type === \App\Enums\SiteType::LOAD_BALANCER)
|
@if ($site->type === \App\Enums\SiteType::LOAD_BALANCER)
|
||||||
upstream backend {
|
upstream {{ $backendName }} {
|
||||||
@switch($site->type_data['method'] ?? \App\Enums\LoadBalancerMethod::ROUND_ROBIN)
|
@switch($site->type_data['method'] ?? \App\Enums\LoadBalancerMethod::ROUND_ROBIN)
|
||||||
@case(\App\Enums\LoadBalancerMethod::LEAST_CONNECTIONS)
|
@case(\App\Enums\LoadBalancerMethod::LEAST_CONNECTIONS)
|
||||||
least_conn;
|
least_conn;
|
||||||
@ -67,7 +71,7 @@
|
|||||||
|
|
||||||
@if ($site->type === \App\Enums\SiteType::LOAD_BALANCER)
|
@if ($site->type === \App\Enums\SiteType::LOAD_BALANCER)
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://backend$request_uri;
|
proxy_pass http://{{ $backendName }}$request_uri;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user