التشغيل خلف وكيل عكسي
أنهوا TLS ووجّهوا HTTP إلى خادمكم.
التشغيل خلف وكيل عكسي درس مجاني في MCP Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في MCP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة MCP Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What a Reverse Proxy Is
A reverse proxy sits in front of your server, taking requests from the internet and quietly forwarding them to your MCP process. 🔀
Why Put One in Front
Your MCP server should focus on logic, not the messy public edge. A proxy handles TLS, routing, and shielding so your code stays simple.
Terminate TLS at the Edge
The proxy decrypts incoming HTTPS and speaks plain HTTP to your server inside. This TLS termination keeps certificates in one place.
Nginx Is a Common Choice
Nginx is a popular, battle-tested reverse proxy. A small config block is enough to route public traffic to your MCP container.
Forward to Your Server
The key directive is proxy_pass, which points the proxy at your server's internal address and port.
location /mcp {
proxy_pass http://127.0.0.1:8000;
}Pass Through the Right Headers
Forward headers like Host and the client's real IP so your server sees accurate request info, not just the proxy itself.
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;Keep Streaming Alive
MCP can stream replies, so disable response buffering for the endpoint. Otherwise the proxy holds events back until the call ends.
proxy_buffering off;Route by Path or Host
One proxy can serve many apps. Match on a path like /mcp or a hostname to send each request to the right backend.
Hide Your Backend Port
With a proxy, clients only ever see port 443. Your real server port stays private on the internal network, never exposed directly.
Add a Layer of Safety
The proxy is a natural spot for rate limits and request size caps, giving your MCP server a first line of defense. 🛡️
A Clean Separation
Edge concerns live in the proxy; business logic lives in your server. That separation makes both far easier to reason about and change.
Quick Check
What is the main job of TLS termination at the reverse proxy?
Recap: Reverse Proxy
A reverse proxy like Nginx fronts your server: it terminates TLS, forwards requests with proxy_pass, and keeps your backend port private. 🔒
الأسئلة الشائعة
هل درس «التشغيل خلف وكيل عكسي» مجاني؟
نعم — نص درس «التشغيل خلف وكيل عكسي» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة MCP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة MCP Academy 4 دروس في المجموع.
ماذا ستتعلم في «التشغيل خلف وكيل عكسي»؟
أنهوا TLS ووجّهوا HTTP إلى خادمكم. تتمرن على MCP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ MCP Academy؟
لا تُشترط خبرة سابقة. MCP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «التشغيل خلف وكيل عكسي»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس MCP Academy هذا؟
نعم. كل درس في MCP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- تغليف الخادم في Docker
- التشغيل خلف وكيل عكسي
- فحوصات السلامة وإعادة التشغيل
- توصيل العملاء البعيدين