diff --git a/nginx/default.conf b/nginx/default.conf index 4e47f74..e8b2ec1 100755 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -4,6 +4,14 @@ server { root /var/www/public; index index.php index.html; + # Keep-alive ve connection ayarları (bağlantı birikmesini önlemek için) + keepalive_timeout 65; + keepalive_requests 100; + client_max_body_size 20M; + client_body_timeout 60s; + client_header_timeout 60s; + send_timeout 60s; + # HTTPS için proxy headers proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; @@ -31,8 +39,18 @@ server { # Timeout ayarları fastcgi_read_timeout 300; - fastcgi_connect_timeout 300; + fastcgi_connect_timeout 60; fastcgi_send_timeout 300; + + # FastCGI keep-alive ve buffer ayarları (bağlantı birikmesini önlemek için) + fastcgi_keep_conn on; + fastcgi_buffering on; + fastcgi_buffer_size 4k; + fastcgi_buffers 8 4k; + fastcgi_busy_buffers_size 8k; + + # Connection pool ayarları + fastcgi_max_temp_file_size 0; } # Gizli dosyaları engelle diff --git a/resources/views/currency.blade.php b/resources/views/currency.blade.php index 36cc99c..c9e42f2 100644 --- a/resources/views/currency.blade.php +++ b/resources/views/currency.blade.php @@ -1,3 +1,4 @@ +@if($rate)
@@ -5,10 +6,10 @@ {{$currencyName}}

-

- {{ $rate['Change'] }}% +

+ {{ $rate['Change'] ?? 0 }}%

- @if($rate['Change'] > 0) + @if(($rate['Change'] ?? 0) > 0) @else @@ -19,12 +20,13 @@

- {{$rate['Selling']}} ₺ + {{$rate['Selling'] ?? '0.00'}} ₺

-
+
-
\ No newline at end of file +
+@endif \ No newline at end of file diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 056d838..4ac69b0 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -128,24 +128,37 @@
@php - $response = file_get_contents('https://finance.truncgil.com/api/today.json'); - $data = json_decode($response, true); + try { + $response = @file_get_contents('https://finance.truncgil.com/api/today.json'); + $data = $response ? json_decode($response, true) : null; + } catch (\Exception $e) { + $data = null; + } + $currencies = ['USD', 'EUR', 'GBP', 'GRA', 'BTC', 'ETH', 'XRP', 'LTC']; $rates = []; - foreach ($currencies as $currency) { - $rates[$currency] = $data['Rates'][$currency] ?? null; + if (isset($data['Rates'])) { + foreach ($currencies as $currency) { + if (isset($data['Rates'][$currency])) { + $rates[$currency] = $data['Rates'][$currency]; + } + } } @endphp
- @foreach($rates AS $currencyName => $rate) + @forelse($rates AS $currencyName => $rate)
@include('currency', [ 'currencyName' => $currencyName, 'rate' => $rate ])
- @endforeach + @empty +
+

Service temporarily unavailable. Please try again later.

+
+ @endforelse