-
-
Notifications
You must be signed in to change notification settings - Fork 0
Nginx Configuration
Amit Das edited this page Apr 28, 2026
·
1 revision
This guide explains how to configure Nginx for SecureAuth.
Nginx is used as a reverse proxy to securely route traffic to the SecureAuth backend server.
Benefits of using Nginx:
- Reverse proxy support
- HTTPS/SSL termination
- Better performance
- Security improvements
- Load balancing support
Before starting:
- Ubuntu/Linux server
- Nginx installed
- SecureAuth running on port
3000
Ubuntu installation:
sudo apt update
sudo apt install nginx -ysudo systemctl status nginxCreate a new Nginx configuration file.
Example:
sudo nano /etc/nginx/sites-available/secureauthserver {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://127.0.0.1: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;
proxy_http_version 1.1;
}
}sudo ln -s /etc/nginx/sites-available/secureauth /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl restart nginxHTTPS is strongly recommended for production deployments.
sudo apt install certbot python3-certbot-nginx -ysudo certbot --nginx -d yourdomain.comserver {
listen 443 ssl;
server_name yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1: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;
proxy_http_version 1.1;
}
}If WebSocket support is needed:
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}/etc/nginx/
├── nginx.conf
├── sites-available/
│ └── secureauth
└── sites-enabled/
└── secureauthAllow required ports.
sudo ufw allow 80
sudo ufw allow 443For production deployments:
- Enable HTTPS
- Disable unused ports
- Use strong SSL settings
- Restrict server access
Client
↓
Nginx Reverse Proxy
↓
SecureAuth Backend
↓
Authentication ValidationCause:
- Backend server not running
Check backend:
curl http://127.0.0.1:3000Test config:
sudo nginx -tRenew certificates:
sudo certbot renewRestart Nginx:
sudo systemctl restart nginxTest application:
curl http://yourdomain.comFor proper PWA support:
- Use HTTPS only
- Ensure service workers load correctly
Continue with:
Secure • Fast • Modern ⚡
SecureAuth
Secure • Fast • Modern ⚡