In our previous article on NGINX, we explored the basics —what it is, where to find its configuration, how to restart it on macOS, how to troubleshoot common 404 errors, and how to set up a basic reverse proxy. That guide provided a strong foundation for beginners who wanted to get hands-on with NGINX in Kubernetes, Docker, and traditional Linux environments.
This advanced article builds on the foundation of the introductory article and takes things further. We dive into production-grade NGINX setup, advanced reverse proxy techniques, SSL/TLS security, Dockerized deployments, Kubernetes ingress configurations, and performance tuning. We’ll also integrate many practical questions developers and sysadmins often ask, such as “how to use embedded keys with NGINX,” “what NGINX proxy manager is,” “how to include subdomains in NGINX,” and “how to enable HTTPS NGINX in Docker.”
As highlighted in the introductory article, NGINX is more than just a web server. It is a reverse proxy, load balancer, caching engine, and security layer. Its event-driven, asynchronous architecture makes it outperform traditional web servers like Apache under heavy currency.
What NGINX is used for:
While Apache remains widely used, NGINX has distinct advantages:
Feature | NGINX | Apache |
Architecture | Event-driven, asynchronous | Process/thread-based |
Performance | Lightweight, handles high concurrency | Higher memory usage |
Reverse Proxy | Built-in, highly optimized | Add-ons required |
Docker Integration First-class support Limited | First-class support | Limited |
WebSocket Support | Native | Requires modules |
For modern containerized deployments (Docker, Kubernetes), NGINX is almost always the default choice.
In Kubernetes, when using ingress-nginx, you can view the active configuration with the following command:
kubectl exec -it — nginx -T
This will dump /etc/nginx/nginx.conf along with conf.d/*.conf files. If you are troubleshooting apps like Superset config nginx or filecloud nginx, this command is invaluable.
You can also mount your own nginx.conf inside the pod using a ConfigMap command:
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-nginx-config
namespace: default
data:
nginx.conf: |
events {}
http {
include /etc/nginx/conf.d/*.conf;
}
Then mount it into the ingress nginx controller deployment.
From our previous article, we know 404 errors often come from misconfigured root or location blocks. But in advanced setups, other causes include:
Do the following commands in each procedure below:
On macOS (as covered before):
brew services restart nginx
On Ubuntu/Debian:
sudo systemctl restart nginx
Inside a Docker container:
docker exec -it nginx-container nginx -s reload
Inside a Kubernetes pod:
kubectl exec -it — nginx -s reload
In the previous article, we showed a simple Dockerfile with NGINX. Now let’s extend it for multi-service reverse proxy with SSL.
For the docker-compose.yml:, use the following commands:
version: ‘3’
services:
nginx:
image: nginx:latest
volumes:
– ./nginx.conf:/etc/nginx/nginx.conf
– ./certs:/etc/nginx/certs
ports:
– “80:80”
– “443:443”
app1:
image: php:8-fpm
volumes:
– ./app1:/var/www/html
app2:
image: node:18
working_dir: /usr/src/app
volumes:
– ./app2:/usr/src/app
nginx.conf: events {}
http {
server {
listen 443 ssl;
server_name app1.local;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
location / {
proxy_pass http://app1:9000;
}
}
server {
listen 443 ssl;
server_name app2.local;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
location / {
proxy_pass http://app2:3000;
}
}
}
This allows NGINX proxy docker setups with multiple domains secured via .pem and .key files.
Some organizations prefer embedded keys inside their NGINX configuration. Instead of referencing external files, you can include the certificate and private key inline.
Additionally, use Basic Auth for restricting access with the following command:
location /admin {
auth_basic “Restricted”;
auth_basic_user_file /etc/nginx/.htpasswd;
}
Combine this with SSL to create a secure login-protected area.
For those who prefer GUIs, NGINX Proxy Manager provides an easy way to configure reverse proxies, SSL certificates, and redirects. Similarly, Heimdall can be fronted by NGINX to create a beautiful dashboard.
NGINX integrates tightly with modern ecosystems:
In the previous article, we laid the groundwork for understanding NGINX basics. This advanced guide expanded on those foundations by covering Dockerized setups, Kubernetes ingress, embedded keys, Proxy Manager, SSL best practices, APISIX integration, and performance tuning.
Whether you are building a docker php sqlite nginx stack, deploying websocket nginx manager, or setting up a production-grade reverse proxy, NGINX remains the industry standards.
NGINX has become one of the most popular web servers in the world, widely praised…
When you’re working within Windows environments, you’ve likely crossed paths with IIS—short for Internet Information…
When it comes to deploying web applications on a Windows-based system, Microsoft Internet Information Services…
PostgreSQL (often called Postgres) is a powerful, open-source relational database management system (RDBMS) renowned for…
PostgreSQL is a robust, open-source object-relational database management system (ORDBMS), commonly referred to as Postgres.…
What is Hadoop? Apache Hadoop is an open-source software framework designed for distributed storage and…
This website uses cookies.