Apache vs Nginx, Proxy
Refs
What and why
Apache and Nginx
- Apache: HTTP server, most popular web server, alias
httpd
- Nginx: HTTP server, reverse proxy server, mail proxy server, generic TCP/UDP proxy server
Proxy
Proxy: a server application that acts as an intermediary between a client requesting a resource and the server providing that resource.
Forward proxy: Proxy for cilents
Forward proxy purposes:
- get over GFW
- Hide client IP
- Accelerate network access: Usually forward proxy servers holds a large cache which accelerates network access by using cache
- Reverse proxy: Proxy for servers
- Reverse proxy purposes:
- Load balancing
- Hide server IP
- Accelerate network access: Work in a similar way as forward proxy
- Network security: reverse proxy can serve as a fireawll for servers
Apache
Nginx
- Nginx: HTTP server, reverse proxy server, mail proxy server, generic TCP/UDP proxy server
Commands
nginx
: start servernginx -s reload
: reoad configuration filenginx -s stop
: fast shutdownnginx -s quit
: graceful shutdown
Configuration
Nginx as static server
1 | server { |
1 | http { |
Nginx as HTTP proxy
1 | server { |
Nginx as TCP proxy
1 | stream { |
Apache vs Nginx, Proxy