参考资料

  1. Nginx负载均衡策略详解
  2. Nginx基于FastCGI实现负载均衡详细说明以及案例
  3. 如何防止勒索病毒攻击?
  4. WSGI(Web Server Gateway Interface,Web 服务网关接口)详细说明以及案例
  5. Nginxserver_name 配置主机名称详细说明以及案例
  6. 如何设置Nginx的Gzip压缩?
  7. NginxWebDAV模块配置详细说明以及案例
  8. Tengine编译安装详细说明以及案例
  1. 反向代理

  • 参数:proxy_pass

  • 示例:

location / {
    proxy_pass http://backend_server;
}
  1. 负载均衡

  • 参数:upstream

  • 示例:

upstream backend {
    server 192.168.1.100:8080;
    server 192.168.1.101:8080;
}
  1. 静态文件服务

  • 参数:root, index

  • 示例:

server {
    root /var/www/html;
    index index.html;
}
  1. SSL/TLS加密

  • 参数:ssl_certificate, ssl_certificate_key

  • 示例:

server {
    listen 443 ssl;
    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;
}
  1. 虚拟主机

  • 参数:server_name

  • 示例:

server {
    listen 80;
    server_name example.com;
}
  1. URL重写

  • 参数:rewrite

  • 示例:

rewrite ^/old/(.*)$ /new/$1 permanent;
  1. 访问控制

  • 参数:allow, deny

  • 示例:

location /admin {
    allow 192.168.1.0/24;
    deny all;
}
  1. Gzip压缩

  • 参数:gzip

  • 示例:

gzip on;
gzip_types text/plain text/css application/json;
  1. 缓存控制

  • 参数:proxy_cache_path, proxy_cache

  • 示例:

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m;
location / {
    proxy_cache my_cache;
}
  1. 日志记录

  • 参数:access_log, error_log

  • 示例:

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;