{"id":2334,"date":"2025-08-23T12:00:56","date_gmt":"2025-08-23T12:00:56","guid":{"rendered":"https:\/\/serverhub.com\/kb\/?p=2334"},"modified":"2025-08-23T12:00:57","modified_gmt":"2025-08-23T12:00:57","slug":"nginx-high-performance-web-server-and-reverse-proxy","status":"publish","type":"post","link":"https:\/\/serverhub.com\/kb\/nginx-high-performance-web-server-and-reverse-proxy\/","title":{"rendered":"NGINX: High-performance Web Server and Reverse Proxy"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"597\" src=\"https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/blog-article-21-Aug-25-2-Blog-artcle-Blog-1024x597.jpg\" alt=\"\" class=\"wp-image-2352\" srcset=\"https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/blog-article-21-Aug-25-2-Blog-artcle-Blog-1024x597.jpg 1024w, https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/blog-article-21-Aug-25-2-Blog-artcle-Blog-300x175.jpg 300w, https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/blog-article-21-Aug-25-2-Blog-artcle-Blog-768x448.jpg 768w, https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/blog-article-21-Aug-25-2-Blog-artcle-Blog.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>NGINX has become one of the most popular web servers in the world, widely praised for its speed, scalability, and versatility. Originally developed to solve the C10k problem (handling 10,000 simultaneous connections), it has evolved into a multi-purpose tool for web hosting, load balancing, reverse proxying, API gateway management, and even email proxying.<\/p>\n\n\n\n<p>In this article, we\u2019ll cover what NGINX is and what it\u2019s used for. We\u2019ll also dive deep into practical configurations and use cases, including Kubernetes, Docker, reverse proxy setups, HTTPS enablement, and advanced features like embedded keys and domain translation.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is NGINX?<\/strong><\/h2>\n\n\n\n<p>NGINX is an open-source, high-performance HTTP server, reverse proxy, and load balancer. Unlike traditional servers like Apache, NGINX uses an event-driven, asynchronous architecture that allows it to handle thousands of connections with minimal memory usage.<\/p>\n\n\n\n<p><strong>Key advantages over Apache:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Better performance for static content.<\/li>\n\n\n\n<li>Lower memory footprint.<\/li>\n\n\n\n<li>Event-driven connection handling.<\/li>\n<\/ul>\n\n\n\n<p><strong>Common use cases include:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Serving static files.<\/li>\n\n\n\n<li>Acting as a reverse proxy to backend applications.<\/li>\n\n\n\n<li>Load balancing multiple servers.<\/li>\n\n\n\n<li>Terminating SSL\/TLS connections.<\/li>\n\n\n\n<li>Handling WebSocket connections.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"624\" height=\"423\" src=\"https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/NGINX-Common-Use-Cases.jpg\" alt=\"\" class=\"wp-image-2337\" srcset=\"https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/NGINX-Common-Use-Cases.jpg 624w, https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/NGINX-Common-Use-Cases-300x203.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>NGINX Configuration Locations<\/strong><\/h2>\n\n\n\n<p><strong>Where is nginx config in a Kubernetes pod?<\/strong><br>If you are running NGINX inside Kubernetes, you can check the configuration inside the container by executing the following command:<br><mark class=\"has-inline-color has-accent-color\">kubectl exec -it &#8212; cat \/etc\/nginx\/nginx.conf<\/mark><\/p>\n\n\n\n<p>Or, if you use NGINX Ingress Controller, use this command:<br><mark class=\"has-inline-color has-accent-color\">kubectl describe configmap nginx-configuration -n ingress-nginx<\/mark><\/p>\n\n\n\n<p>On traditional systems, the configuration is usually found at:<br><mark class=\"has-inline-color has-accent-color\">\/etc\/nginx\/nginx.conf<\/mark><br><mark class=\"has-inline-color has-accent-color\">\/etc\/nginx\/conf.d\/<\/mark><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Common NGINX Troubleshooting<\/strong><\/h2>\n\n\n\n<p><strong>How can I fix 404 Not Found NGINX error message?<\/strong><br>A 404 error in NGINX usually means the server couldn\u2019t find the requested file. To fix this issue, do the following steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Check the root or alias directive in your location block.<\/li>\n\n\n\n<li>Verify file permissions.<\/li>\n\n\n\n<li>Reload NGINX after changes with the following command: <mark class=\"has-inline-color has-accent-color\">sudo nginx -s reload<\/mark><\/li>\n<\/ol>\n\n\n\n<p>How do I restart my NGINX server on a MacBook?<br>Use the following commands for the following installation procedures.<br>If installed via Homebrew: <mark class=\"has-inline-color has-accent-color\">brew services restart nginx<\/mark><\/p>\n\n\n\n<p>Or manually: <mark class=\"has-inline-color has-accent-color\">sudo nginx -s reload<\/mark><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>NGINX with Docker<\/strong><\/h2>\n\n\n\n<p><strong>Do the following steps for each NGINX with Docker procedure<\/strong>.<br><strong>How to create NGINX proxy in Docker:<\/strong><br><mark class=\"has-inline-color has-accent-color\">docker run &#8211;name nginx-proxy -p 80:80 -v \/path\/to\/conf:\/etc\/nginx\/conf.d -d nginx<\/mark><\/p>\n\n\n\n<p><strong>How to set up Docker reverse proxy server:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"624\" height=\"351\" src=\"https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/How-to-Set-up-Docker.jpg\" alt=\"\" class=\"wp-image-2344\" srcset=\"https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/How-to-Set-up-Docker.jpg 624w, https:\/\/serverhub.com\/kb\/wp-content\/uploads\/2025\/08\/How-to-Set-up-Docker-300x169.jpg 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>You can point NGINX to backend containers by linking services or using Docker networks.<br><mark class=\"has-inline-color has-accent-color\">server {<br>           listen 80;<br>           location \/ {<br>           proxy_pass http:\/\/backend_app:5000;<br>         }<br>}<\/mark><\/p>\n\n\n\n<p>NGINX latest Docker image zip can be pulled with:<br><mark class=\"has-inline-color has-accent-color\">docker pull nginx:latest<\/mark><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Security &amp; SSL<\/strong><\/h2>\n\n\n\n<p>Do the following steps for each Security and SSL procedure.<\/p>\n\n\n\n<p><strong>How to translate IP to secured domain in NGINX:<\/strong><br>Use a server_name directive with SSL certificates:<\/p>\n\n\n\n<p><mark class=\"has-inline-color has-accent-color\">server {<br>listen 443 ssl;<br>server_name example.com;<br>ssl_certificate \/etc\/nginx\/ssl\/cert.pem;<br>ssl_certificate_key \/etc\/nginx\/ssl\/key.pem;<br>}<\/mark><\/p>\n\n\n\n<p><strong>How to enable HTTPS in NGINX:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install SSL certificate (Let\u2019s Encrypt, etc.).<\/li>\n\n\n\n<li>Update your configuration with listen 443 ssl;.<\/li>\n\n\n\n<li>Reload NGINX.<\/li>\n<\/ol>\n\n\n\n<p><strong>How to use a password with NGINX .pem and .key:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Use OpenSSL to remove the password from the private key for automated restarts: <mark class=\"has-inline-color has-accent-color\">openssl rsa -in private.pem -out nopass.key<\/mark><\/li>\n\n\n\n<li>Then configure NGINX to use nopass.key.<\/li>\n<\/ol>\n\n\n\n<p><strong>How to use embedded keys with NGINX:<\/strong><br>Embed both certificate and key in the same PEM file and reference it in the ssl_certificate directive.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Using NGINX in Kubernetes (Ingress)<\/strong><\/h2>\n\n\n\n<p><strong>Ingress NGINX<\/strong> is a Kubernetes controller that exposes HTTP\/HTTPS routes from outside the cluster to services within.<br>Below is an example manifest:<br><mark class=\"has-inline-color has-accent-color\">apiVersion: networking.k8s.io\/v1<br>kind: Ingress<br>metadata:<br>name: example-ingress<br>annotations:<br>    nginx.ingress.kubernetes.io\/rewrite-target: \/<br>spec:<br>       rules:<br>       &#8211; host: example.com<br>          http:<br>            paths:<br>            &#8211; path: \/<br>               pathType: Prefix<br>               backend:<br>                   service:<br>                   name: my-service<br>                   port:<br>                   number: 80<\/mark><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>NGINX vs Apache<\/strong><\/h2>\n\n\n\n<p>While Apache is process-based, NGINX is event-based, leading to better scalability under heavy loads. Apache excels in .htaccess flexibility and dynamic content handling, while NGINX dominates in static file delivery and high-concurrency scenarios.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Logs &amp; Monitoring<\/strong><\/h2>\n\n\n\n<p><strong>NGINX Logs:<\/strong><br>Default locations:<br><mark class=\"has-inline-color has-accent-color\">\/var\/log\/nginx\/access.log<br>\/var\/log\/nginx\/error.log<\/mark><\/p>\n\n\n\n<p>These logs help debug issues such as failed requests, SSL handshake errors, or proxy failures.<br><strong>NGINX Proxy Manager<\/strong> provides a GUI to manage proxies, SSL, and routing rules without editing config files manually.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Advanced Features<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>NGINX conf.d http \u2014 add custom HTTP server blocks in \/etc\/nginx\/conf.d.<\/li>\n\n\n\n<li>NGINX include subdomains \u2014 use server_name *.example.com;<\/li>\n\n\n\n<li>APISIX NGINX worker \u2014 Apache APISIX uses NGINX workers for plugin execution.<\/li>\n\n\n\n<li>FileCloud NGINX \u2014 integrate FileCloud\u2019s storage gateway with NGINX as a reverse proxy.<\/li>\n\n\n\n<li>WebSocket NGINX manager \u2014 configure proxy_set_header Upgrade $http_upgrade; for WebSockets.<\/li>\n\n\n\n<li>Superset config NGINX \u2014 proxy Apache Superset through NGINX for HTTPS access.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Installing NGINX and Setting up SSL on Ubuntu<\/strong><\/h2>\n\n\n\n<p>Use the following commands for each procedure of installing NGINX on Ubuntu:<br><mark class=\"has-inline-color has-accent-color\">sudo apt update<br>sudo apt install nginx<br>sudo apt install certbot python3-certbot-nginx<br>sudo certbot &#8211;nginx -d example.com<\/mark><\/p>\n\n\n\n<p>The command above will install NGINX, request an SSL certificate, and configure HTTPS automatically.<\/p>\n\n\n\n<p><strong>Ubuntu install NGINX specific path:<\/strong><br>You can use &#8211;prefix when compiling from source:<br><mark class=\"has-inline-color has-accent-color\">. \/Configure &#8211;prefix=\/opt\/nginx  make &amp;&amp; sudo make install<\/mark><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Restarting and Reloading NGINX<\/strong><\/h2>\n\n\n\n<p>Use the following commands for each Restart and Reload procedures.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Restart: <mark class=\"has-inline-color has-accent-color\">sudo systemctl restart nginx<\/mark><\/li>\n\n\n\n<li>Reload without downtime: <mark class=\"has-inline-color has-accent-color\">sudo nginx -s reload<\/mark><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>NGINX is more than a web server \u2014 it\u2019s a robust, flexible, and high-performance reverse proxy, load balancer, and API gateway. Whether you\u2019re deploying in Kubernetes, running in Docker, or hosting traditional web applications, its efficiency and scalability make it a top choice.<\/p>\n\n\n\n<p>Its versatility extends from simple static file serving to complex SSL setups, embedded key management, password-protected certificates, and advanced Kubernetes ingress routing. By understanding where configurations live, how to troubleshoot common issues, and how to set up secure, high-performance environments, you can leverage NGINX to its fullest potential.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>References:<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/nginx.org\/en\/\" title=\"\">NGINX Official Docs<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.nginx.com\/nginx\/admin-guide\/\" title=\"\">NGINX Admin Guide<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/kubernetes.github.io\/ingress-nginx\/\" title=\"\">Kubernetes NGINX Ingress Controller<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Nginx?utm_source=chatgpt.com\" title=\"\">Nginx &#8211; Wikipedia<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.wired.com\/2013\/09\/nginx\/?utm_source=chatgpt.com\" title=\"\">This Russian Software Is Taking Over the Internet | WIRED<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/medium.com\/%40sanathshetty444\/comprehensive-guide-to-nginx-from-basic-setup-to-production-ready-load-balancing-a6209c604305?utm_source=chatgpt.com\" title=\"\">Comprehensive Guide to Nginx: From Basic Setup to Production-Ready Load Balancing | by Sanath Shetty | Jul, 2025 | Medium<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.hostinger.com\/tutorials\/what-is-nginx?utm_source=chatgpt.com\" title=\"\">What Is NGINX and What Is It Used For?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/nginx\/kubernetes-ingress\/issues\/1675?utm_source=chatgpt.com?utm_source=chatgpt.com\" title=\"\">github.com\/nginx\/kubernetes-ingress\/issues\/1675?utm_source=chatgpt.com?utm_source=chatgpt.com<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.solo.io\/topics\/nginx?utm_source=chatgpt.com\" title=\"\">Understanding NGINX: Architecture, Configuration &amp; Alternatives | Solo.io<\/a><\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NGINX has become one of the most popular web servers in the world, widely praised for its speed, scalability, and versatility. Originally developed to solve the C10k problem (handling 10,000 simultaneous connections), it has evolved into a multi-purpose tool for web hosting, load balancing, reverse proxying, API gateway management, and even email proxying. In this &#8230; <a title=\"NGINX: High-performance Web Server and Reverse Proxy\" class=\"read-more\" href=\"https:\/\/serverhub.com\/kb\/nginx-high-performance-web-server-and-reverse-proxy\/\" aria-label=\"More on NGINX: High-performance Web Server and Reverse Proxy\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[101,60,62,1],"tags":[171,176],"class_list":["post-2334","post","type-post","status-publish","format-standard","hentry","category-cloud-computing","category-how-to","category-tutorial","category-uncategorized","tag-dedicatedservers","tag-nginx-webserver-reverseproxy"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/posts\/2334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/comments?post=2334"}],"version-history":[{"count":18,"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/posts\/2334\/revisions"}],"predecessor-version":[{"id":2355,"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/posts\/2334\/revisions\/2355"}],"wp:attachment":[{"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/media?parent=2334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/categories?post=2334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serverhub.com\/kb\/wp-json\/wp\/v2\/tags?post=2334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}