This document provides a detailed explanation of the changes and enhancements made to the NGINX configuration for the www.wisewalletai.com server. The configuration focuses on optimizing security, performance, and access control. It includes the implementation of IP-based restrictions, HTTPS enforcement, custom error pages, and efficient logging for better debugging and maintenance.
1. Objectives
Enforce HTTPS for secure connections.
Restrict access to specific resources (/report.html) by IP address.
Implement custom error pages for better user experience and troubleshooting.
Hide server version information for security.
Log access and errors in a detailed and structured format.
Optimize performance through NGINX best practices.
2. Configuration Changes
2.1 General Configuration
Set User and Worker Processes:
Why: Defines the NGINX user (www-data) and automatically adjusts worker processes based on available CPU cores for optimal performance.
Configuration:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
Optimize Events Block:
Why: Configures event handling for high-performance and multi-acceptance connections.
Configuration:
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
2.2 HTTP Block
Hide Server Tokens:
Why: Prevents exposing the NGINX version in responses, reducing the risk of targeted attacks.
Configuration:
server_tokens off;
Logging:
Why: Structured access and error logs help in troubleshooting and analytics.
Configuration:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '