mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 01:41:36 +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
|
||||
|
||||
@php
|
||||
$backendName = preg_replace("/[^A-Za-z0-9 ]/", '', $site->domain).'_backend';
|
||||
@endphp
|
||||
|
||||
@if ($site->type === \App\Enums\SiteType::LOAD_BALANCER)
|
||||
upstream backend {
|
||||
upstream {{ $backendName }} {
|
||||
@switch($site->type_data['method'] ?? \App\Enums\LoadBalancerMethod::ROUND_ROBIN)
|
||||
@case(\App\Enums\LoadBalancerMethod::LEAST_CONNECTIONS)
|
||||
least_conn;
|
||||
@ -67,7 +71,7 @@
|
||||
|
||||
@if ($site->type === \App\Enums\SiteType::LOAD_BALANCER)
|
||||
location / {
|
||||
proxy_pass http://backend$request_uri;
|
||||
proxy_pass http://{{ $backendName }}$request_uri;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
Loading…
x
Reference in New Issue
Block a user