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

    •  How to Fix Windows 11 ISO Download Blocked and Error Messages
    • How to Make Your Website Vibrate with Web Haptics
    • Measuring LLM Bullshit Benchmark
    • A Step-by-Step Guide to ZITADEL Identity Infrastructure
    • How NVIDIA G-SYNC Pulsar is Finally Fixing Motion Blur Forever
    • How Multipathing Keeps Your Linux Systems Running Smoothly!
    • Forgejo: A Self-hosted Github Alternative You Should Try
    • Introducing Zo Computer, How it Will Changing Personal Data Science Forever
    • Which AI Brain Should Your Coding Agent Use? A Deep Dive into the OpenHands Index
    • Hoppscotch, The Postman Killer: Why You Should Switch from Postman to Hoppscotch Right Now
    • Nitrux 6.0 Released with Linux Kernel 6.19: What’s New?
    • How to Upgrade Pop!_OS 22.04 LTS to 24.04 LTS: A Step-by-Step Guide
    • KDE Plasma 6.6.2 Released: Key Bug Fixes and Enhancements Explained
    • Meet the Huawei NetEngine 8000: The Router Powering the Next Generation of AI-Driven Networks!
    • LLM Settings That Every AI Developer Must Know
    • Is Your Second Monitor a Mess? Kubuntu 26.04 Resolute Raccoon Finally Fixes Multi-Display Woes!
    • How to Run Massive AI Models on Your Mac: Unlocking Your Hidden VRAM Secrets
    • How to Create Gemini CLI Agent Skills
    • WTF? Ubuntu Planning Mandatory Age Verification
    • Why This Retro PC is Actually a Modern Beast: Maingear Retro98
    •  Windows 11 Taskbar Update: How to Move and Resize Your Taskbar Again
    • Does KDE Plasma Require Systemd? Debunking the Mandatory Dependency Myths
    •  How to Fix ‘docs.google.com Refused to Connect’ Error in Windows 10/11
    • Aerynos Feb 2026 Update: Faster Desktops and Moss Performance Boost
    • Pangolin 1.16 Adds SSH Auth Daemon: What You Need to Know
    • Inilah 10 Kesalahan Fatal Saat Beli Properti yang Bisa Bikin Kalian Bangkrut!
    • Belum Tahu Cara Masuk Simpatika Terbaru? Ini Cara Login PTK EMIS GTK IMP 2026 Supaya Cek TPG Jadi Lebih Gampang!
    • Inilah Cara Bikin Konten Animasi AI Cuma Modal HP Supaya Bisa Gajian Rutin dari YouTube
    • Inilah Alasan Kenapa Zakat ke Ormas yang Belum Diakui Negara Nggak Bisa Dipakai Buat Ngurangin Pajak!
    • Inilah Cara Belanja di Indomaret Pakai Shopee PayLater yang Praktis dan Bikin Hemat!
    • The Secret Reason Seedance 2.0 is Realistic
    • Exploring Microsoft Phi-4 Reasoning Vision 15B
    • Gemini 3.1 Flash-Lite Released: How to Master Google’s Fastest AI Model for Real-World Projects
    • Qwen Is Ruined! Why the Masterminds Behind Qwen 3.5 Left Alibaba Cloud
    • GPT-5.3 Instant Revealed: How the New OpenAI Update Changes Everything for AI Users
    • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
    • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
    • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
    • Siapa itu Kelompok Hacker Silver Fox?
    • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025
    ©2026 Tutorial emka | Design: Newspaperly WordPress Theme