Nginx (engine x) is a high-performance HTTP server, reverse proxy server, and IMAP/POP3/SMTP proxy server developed by Russian programmer Igor Sysoev.
Core Features
HTTP Server Capabilities
- Static file serving and automatic indexing
- Reverse proxy acceleration without caching
- Load balancing and fault tolerance
- FastCGI support with load balancing
- Module-based architecture with filters (gzip, byte ranges, chunked responses, SSI)
- SSL/TLS SNI support
IMAP/POP3 Proxy Functions
- External HTTP authentication server integration
- User redirection to IMAP/POP3 backends
- Authentication methods including POP3 USER/PASS, APOP, AUTH LOGIN PLAIN CRAM-MD5, IMAP LOGIN, and SMTP AUTH
- SSL and STARTTLS support
Linux Installation
Nginx requires PCRE for rewrite functionality, OpenSSL for SSL support, and zlib for compression.
Dependency Installation
PCRE Setup
Download PCRE from the official source and upload to /opt/nginx/:
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
make
make install
pcre-config --version
zlib Setup
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
OpenSSL Setup
tar -zxvf openssl-1.0.2q.tar.gz
cd openssl-1.0.2q
./config
make
make install
Nginx Setup
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure
make
make install
Verify installation:
/usr/local/nginx/sbin/nginx -v
If you encounter error while loading shared libraries: libpcre.so.1, create a symbolic link:
ln -s /usr/local/lib/libpcre.so.1 /lib64/
Operational Commands
Test configuration:
/usr/local/nginx/sbin/nginx -t
Start service:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
Reload configuration:
/usr/local/nginx/sbin/nginx -s reload
Graceful shutdown:
kill -QUIT $(cat /usr/local/nginx/logs/nginx.pid)
Forceful termination:
ps -ef | grep nginx
kill -9 [process_id]
Restart:
kill -HUP $(cat /usr/local/nginx/logs/nginx.pid)
After successful startup, access Nginx via browser using the server's IP address on port 80.
Windows Installation
Windows installation is straightforward with no external dependencies required.
Download the Windows binary from nginx.org and extract the archive. Launch nginx using one of these methods:
- Double-click
nginx.exe - Run
start nginxfrom the command line in the extraction directory
Windows Commands
Stop nginx:
nginx -s stop
Graceful stop:
nginx -s quit
Reload configuration:
nginx -s reload
Access the server by opening localhost or 127.0.0.1 in you're browser.
Reverse Proxy and Load Balancing
Nginx distributes client requests across multiple backend servers using configurable strategies. By default, it uses weighted round-robin where servers with higher weight receive more requests. If a backend server fails, Nginx automatically removes it from the pool to ensure continued service availability.
Forward Proxy — proxies requests on behalf of clients Reverse Proxy — proxies requests to backend servers on behalf of the server infrastructure