{"id":2150,"date":"2026-07-22T18:17:42","date_gmt":"2026-07-22T11:17:42","guid":{"rendered":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-configure-nginx-as-a-reverse-proxy-a-step-by-step-guide\/"},"modified":"2026-07-22T18:17:42","modified_gmt":"2026-07-22T11:17:42","slug":"how-to-configure-nginx-as-a-reverse-proxy-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-configure-nginx-as-a-reverse-proxy-a-step-by-step-guide\/","title":{"rendered":"How to Configure NGINX as a Reverse Proxy: A Step-by-Step Guide"},"content":{"rendered":"<h1>How to Configure NGINX as a Reverse Proxy: A Step-by-Step Guide<\/h1>\n<p>Setting up NGINX as a reverse proxy is a powerful way to improve your web application\u2019s performance, security, and scalability. Instead of exposing your backend servers directly, NGINX sits in front, forwarding client requests to the appropriate backend. This tutorial walks you through the configuration process with simple, actionable steps.<\/p>\n<p>Before you begin, ensure NGINX is installed on your server (e.g., Ubuntu, CentOS) and you have sudo access. The basic principle remains the same across distributions.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/via.placeholder.com\/800x600\/4a90d9\/ffffff?text=how%20to%20configure%20NGINX%20as%20a%20reverse%20proxy\" alt=\"Article illustration\" style=\"display:block;margin:20px auto;max-width:100%;height:auto;border-radius:8px;\" \/><\/p>\n<h2>1. Basic Reverse Proxy Configuration<\/h2>\n<p>Open your NGINX configuration file (usually <code>\/etc\/nginx\/sites-available\/example.com<\/code> or <code>\/etc\/nginx\/nginx.conf<\/code>). Inside the <code>server<\/code> block, add a <code>location<\/code> directive:<\/p>\n<pre>\nserver {\n    listen 80;\n    server_name example.com;\n\n    location \/ {\n        proxy_pass http:\/\/localhost:3000;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n    }\n}\n<\/pre>\n<p><strong>Explanation:<\/strong> <code>proxy_pass<\/code> directs traffic to your backend (here, a Node.js app on port 3000). The <code>proxy_set_header<\/code> lines preserve the original client information.<\/p>\n<h2>2. Handling WebSocket Connections<\/h2>\n<p>If your backend uses WebSockets (e.g., live chat, real-time updates), add these lines inside the same <code>location<\/code> block:<\/p>\n<pre>\nproxy_http_version 1.1;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection \"upgrade\";\n<\/pre>\n<p>This allows NGINX to properly upgrade the connection to WebSocket protocol.<\/p>\n<h2>3. Optimizing Timeouts and Buffering<\/h2>\n<p>To avoid client timeouts or slow uploads, adjust these settings inside the <code>location<\/code> block:<\/p>\n<pre>\nproxy_read_timeout 300s;\nproxy_send_timeout 300s;\nproxy_buffering off;\n<\/pre>\n<p><code>proxy_buffering off<\/code> is useful for streaming applications or real-time APIs where immediate response is critical.<\/p>\n<h2>4. Testing and Reloading<\/h2>\n<p>Always test your configuration for syntax errors:<\/p>\n<pre>\nsudo nginx -t\n<\/pre>\n<p>If the test passes, reload NGINX to apply changes:<\/p>\n<pre>\nsudo systemctl reload nginx\n<\/pre>\n<p>Verify by accessing your domain \u2013 the backend content should now be served through NGINX.<\/p>\n<h2>Conclusion<\/h2>\n<p>Configuring NGINX as a reverse proxy is straightforward once you understand the core directives. Start with the basic <code>proxy_pass<\/code>, then add headers, WebSocket support, and timeouts as needed. This setup centralizes traffic, simplifies SSL termination, and boosts your application\u2019s reliability.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Configure NGINX as a Reverse Proxy: A Step-by-Step Guide Setting up NGINX as a reverse proxy is a powerful way to improve your web application\u2019s performance, security, and scalability. Instead of exposing your backend servers directly, NGINX sits in front, forwarding client requests to the appropriate backend. This tutorial walks you through the &hellip; <\/p>\n","protected":false},"author":2716,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-2150","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/users\/2716"}],"replies":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/comments?post=2150"}],"version-history":[{"count":0,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2150\/revisions"}],"wp:attachment":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media?parent=2150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/categories?post=2150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/tags?post=2150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}