Files
intaleq/docker/nginx/siro-sockets-tls.conf
Hamza-AyedandClaude Opus 5 92dc6b3641 chore: استيراد أولي من سيرو (ecfe7568) — بلا أي تعديل
نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق».
نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا
`cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules ·
.dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore.

هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً
مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ.

⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا
صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم
توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 05:10:29 +03:00

109 lines
5.2 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ══════════════════════════════════════════════════════════════════
# ‏إنهاء TLS أمام سوكيتات Workerman
# ══════════════════════════════════════════════════════════════════
# ‏يُنسَخ على **المضيف** لا داخل الحاويات:
# /etc/nginx/sites-enabled/siro-sockets-tls.conf
#
# ‏المشكلة التي يحلّها: حاويتا السوكيت تفتحان المنفذين نصاً صريحاً
# (‏new SocketIO(2020)‎ و ‎new SocketIO(3030)‎ بلا سياق SSL)، بينما
# ‏التطبيقان يطلبان ‎https://jordan-siro.intaleqapp.com:2020‎ و ‎:3030‎.
# ‏مصافحة TLS ضد منفذ لا يتكلم TLS تتجمّد حتى المهلة، فيظهر في اللوج:
# Socket Connect Error: timeout
#
# ‏الحل: الحاويتان تُنشران على 127.0.0.1 فقط (12020 / 13030 — انظر
# ‏docker-compose.yml)، و nginx هنا يستمع على 2020 / 3030 بشهادة الدومين
# ‏ويمرّر إليهما مع ترقية WebSocket. النتيجة: روابط التطبيقين تبقى كما هي
# ‏بلا أي بناء جديد، والـ JWT في الـ query string يبقى داخل نفق TLS.
# ══════════════════════════════════════════════════════════════════
# ‏ملاحظة: لا نضع ‎http2‎ إطلاقاً هنا. أولاً لأن ترقية WebSocket تعتمد على
# ‏ترويسة ‎Upgrade‎ في HTTP/1.1 ولا معنى لها في HTTP/2، وثانياً لأن ‎http2 on;‎
# ‏لم يُضَف إلا في nginx 1.25.1 وnginx المضيف أقدم فيرفضه بـ:
# nginx: [emerg] unknown directive "http2"
# ‏اسم مميّز يتفادى التضارب مع أي map باسم ‎$connection_upgrade‎ قد يكون
# ‏CloudPanel معرِّفه أصلاً في سياق http.
map $http_upgrade $siro_connection_upgrade {
default upgrade;
'' close;
}
# ── سوكيت السائقين — GPS ─────────────────────────────────────────
server {
listen 2020 ssl;
listen [::]:2020 ssl;
server_name jordan-siro.intaleqapp.com;
# ‏عدّل المسارين إن كانت شهادتك في مكان آخر — تحقّق بالأمر:
# grep -rh ssl_certificate /etc/nginx/sites-enabled/ | sort -u
ssl_certificate /etc/nginx/ssl-certificates/jordan-siro.intaleqapp.com.crt;
ssl_certificate_key /etc/nginx/ssl-certificates/jordan-siro.intaleqapp.com.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SiroSock:10m;
ssl_session_timeout 1d;
# ‏لا سجلّ وصول: نبضات GPS تصل كل ثوانٍ وتُغرق القرص
access_log off;
error_log /var/log/nginx/siro-socket-driver-error.log warn;
location / {
proxy_pass http://127.0.0.1:12020;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $siro_connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# ‏اتصال السائق يعيش ساعات وهو أونلاين — بلا هذه المهل يقطعه nginx
# ‏كل 60 ثانية فتدخل الحاوية في حلقة إعادة اتصال دائمة.
proxy_connect_timeout 10s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
# ‏التخزين المؤقّت يُعطّل الدفع الفوري في WebSocket
proxy_buffering off;
}
}
# ── سوكيت الركاب — حالة الرحلة وموقع السائق ──────────────────────
server {
listen 3030 ssl;
listen [::]:3030 ssl;
server_name jordan-siro.intaleqapp.com;
ssl_certificate /etc/nginx/ssl-certificates/jordan-siro.intaleqapp.com.crt;
ssl_certificate_key /etc/nginx/ssl-certificates/jordan-siro.intaleqapp.com.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SiroSock:10m;
ssl_session_timeout 1d;
access_log off;
error_log /var/log/nginx/siro-socket-passenger-error.log warn;
location / {
proxy_pass http://127.0.0.1:13030;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $siro_connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 10s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
proxy_buffering off;
}
}