Skip to content
Tutorial emka
Menu
  • Home
  • Debian Linux
  • Ubuntu Linux
  • Red Hat Linux
Menu

Tutorial Cara Setting Nginx Server dan Websocket

Posted on October 29, 2024

Dalam dunia aplikasi yang serba cepat, update real-time seperti notifikasi langsung atau fitur chat menjadi sangat penting. WebSockets, sebuah teknologi yang memungkinkan koneksi dua arah terus-menerus antara klien dan server, menjadi kunci untuk menghadirkan pengalaman ini. Namun, untuk memastikan koneksi WebSockets berjalan lancar, Anda perlu mengatur server web Anda, seperti Nginx, dengan tepat.

https://example.comwss://example.com/live-updates

/etc/nginx/sites-available/default/etc/nginx/nginx.conf

server {
    listen 80;
    server_name example.com;

    # Konfigurasi lainnya (seperti root, index, dll.)

    location /live-updates {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }

    location / {
        proxy_pass http://localhost:3000;
        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;
    }
}
    

Penjelasan Konfigurasi:

  • proxy_passlocalhost:3000

  • proxy_http_version 1.1

  • proxy_set_header Upgrade $http_upgradeproxy_set_header Connection “upgrade”

  • Langkah 3: Merestart Nginx

    Setelah melakukan perubahan, restart Nginx untuk menerapkan konfigurasi baru. Jalankan perintah berikut:

          sudo systemctl restart nginx
        

    Recent Posts

    • Grain DataLoader Python Library Explained for Beginners
    • Controlling Ansible with AI: The New MCP Server Explained for Beginners
    • Is Your Headset Safe? The Scary Truth Bluetooth Vulnerability WhisperPair
    • Dockhand Explained, Manage Docker Containers for Beginners
    • Claude Co-Work Explained: How AI Can Control Your Computer to Finish Tasks
    • NVIDIA Rubin Explained: The 6-Chip Supercomputer That Changes Everything
    • What is OpenEverest? The Future of Database Management on Kubernetes
    • T3g: Code is Cheap Now, Software Isn’t
    • Is the New $130 Raspberry Pi AI Hat+ 2 Worth Your Allowance? A Detailed Review
    • Create AI Voices on Your CPU: Pocket TTS Explained for Beginners
    • Building Your First Server: Windows Server Setup and Active Directory
    • OpenNebula VM High Availability Explained
    • Koffan: Self-Hosted App for Shopping List
    • CSIRT Tips for Incident Response Planning
    • Build Your Own Offline-Ready Cloud Storage with Phylum and TrueNAS
    • How to Run Hugging Face Checkpoints on JAX or PyTorch with Keras Hub
    • RTX 5060 vs. Used 4060 Ti: Is the New Budget King Worth the Extra $50?
    • Building a Windows Home Lab in 2026? Follow this Step
    • What is DeepSeek’s Engram?
    • How to Installing Zabbix 7.2 on Ubuntu 25.10 for Real-Time Monitoring
    • Review MySQL Database Recovery Tool by Stellar
    • RQuickShare Tutorial: How to Bring Android’s Quick Share Feature to Your Linux Desktop
    • Why Storage & Memory Price Surges | Self-hosting Podcast January 14th, 2026
    • Tailwind’s Revenue Down 80%: Is AI Killing Open Source?
    • Building Open Cloud with Apache CloudStack
    • Takut Chat Hilang? Ini Cara Mudah Backup WA GB ke Google Drive yang Wajib Kalian Tahu!
    • Tutorial Ambil Barang Gratis di Akulaku, Modal Undang Teman Doang!
    • Ini Arti Kode Error FP26EV dan FP27EV di Aplikasi BriMO Serta Cara Mengatasinya!
    • Cara Jadi Clipper Modal Ngedit Video di TryBuzzer, Cocok Banget Buat Pemula!
    • Cara Pakai Beb6 Wifi Password Untuk Cek Jaringan di Sekitar Kalian
    • Tutorial Langfuse: Pantau & Optimasi Aplikasi LLM
    • Begini Teknik KV Caching dan Hemat Memori GPU saat Menjalankan LLM
    • Apa itu State Space Models (SSM) dalam AI?
    • Begini Cara Mencegah Output Agen AI Melenceng Menggunakan Task Guardrails di CrewAI
    • Tutorial AI Lengkap Strategi Indexing RAG
    • Apa itu Zoom Stealer? Ini Definisi dan Bahaya Tersembunyi di Balik Ekstensi Browser Kalian
    • Apa itu Skandal BlackCat Ransomware?
    • Apa itu ToneShell? Backdoor atau Malware Biasa?
    • Apa itu Parrot OS 7? Ini Review dan Update Terbesarnya
    • Clipper Malware? Ini Pengertian dan Bahaya yang Mengintai Kalian
    ©2026 Tutorial emka | Design: Newspaperly WordPress Theme