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 Maintained the SSD with TRIM
    • What is CVE-2024-21009? Microsoft Office Security Serious Bug
    • Windows 11 Shutdown Problems: Why Your PC Won’t Turn Off (and What Microsoft’s Doing)
    • What is the Steam Overlay Error?
    • Why Your Computer Thinks Winaero Tweaker is Bad (and Why It’s Probably Wrong!)
    • What is Origami Linux? A Super-Safe, Unchangeable Computer System!
    • Why Does OneNote Freeze? Easy Fixes for Typing & Drawing Problems!
    • What is Protected File System (PFS) in Windows 11?
    • Linux News Roundup February 2026
    • How to Install JellyFin Media Server on Samsung TV with TizenOS
    • Why OneNote Clears Your Notes
    • AMD NPU Monitoring on Linux: A Beginner’s Guide to AI Chip Tracking!
    • How to Fix AMD Adrenalin’s Game Detection Issues on Windows
    • Greg Kroah-Hartman Wins Multiple Award at European Open Source Awards!
    • What are Microsoft Copilot Reminders?
    • What’s New in Plasma 6.7? Quick Notification History Clear-Up!
    • Awesome Alternatives to Microsoft Defender Application Guard (MDAG)
    • How tto Enable DLSS 4 & 5 for Your GPU
    • Backlinks: Why They’re Super Important for Your Website!
    • Gnome’s Smart Windows: Tiling Shell 17.3 Makes Organizing Your Screen Easier!
    • How to Replace Notepad with Microsoft Edit
    • What’s New in Shotcut 26.1?
    • Spotify Introduces Group Chat Feature: Sharing Music and Podcasts with Friends Directly
    • Microsoft Will Fix Windows 11 Performance and User Experience Issues in 2026
    • Windows 11 KB5074105 Update Explained
    • Kenapa No Token Gagal Terus? Begini Cara Memasukkan!
    • Kode Bank Terbaru 2026: Kenali Arti dan Fungsinya! Jangan Sampai Salah Transfer
    • Bahayanya ‘Kumpulan Grup Asupan Malam Hijab Lokal Bocil Indo’, Waspada Phising!
    • Kenapa Voucher Axis Gagal Terus? Ini Dia Penyebab & Cara Mengatasinya!
    • Kenapa Meta AI Nggak Muncul di WhatsApp Padahal Udah Update?
    • Cara Membuat Podcast dari PDF dengan NotebookLlama dan Groq
    • Tutorial Membuat Sistem Automatic Content Recognition (ACR) untuk Deteksi Logo
    • Apa itu Google Code Wiki?
    • Cara Membuat Agen AI Otomatis untuk Laporan ESG dengan Python dan LangChain
    • Cara Membuat Pipeline RAG dengan Framework AutoRAG
    • 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