Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nginx

БесплатноБез исполняемых скриптовНе проверен

Nginx reverse proxy and web server configuration skill. USE WHEN: - Configuring Nginx as a reverse proxy in front of application servers (Node.js, Python…

claude-dev-suiteот claude-dev-suite★ 51 звезда на GitHub

Об этом скилле

Nginx — Reverse Proxy & Web Server

Core Concepts

Nginx uses a master/worker process model. The master reads config and manages workers; workers handle connections. The event loop in each worker is non-blocking, so a single worker can handle thousands of concurrent connections.

Key config hierarchy:

http { ... }                # Global HTTP settings
  upstream backend { ... }  # Pool of app servers
  server { ... }            # Virtual host (vhost)
    location / { ... }      # URI matching block

Nginx evaluates server blocks by listen port and server_name. Inside a server, location blocks are matched in order: exact (=), prefix longest-match (^~), regex (~, ~*), then implicit prefix.


Production HTTPS Server Block (Full Template)

# /etc/nginx/sites-available/myapp.conf

# --- Upstream pool -----------------------------------------------------------
upstream app_backend {
    least_conn;                        # Route to least-busy worker
    server 127.0.0.1:3000;
    server 127.0.0.1:3001;
    keepalive 64;                      # Persistent connections to upstream
}

# --- Rate limiting zones (defined in http{} context in nginx.conf) -----------
# limit_req_zone $binary_remote_addr zone=api:10m rate=20r/s;
# limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;

# --- HTTP → HTTPS redirect ---------------------------------------------------
server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    # Allow Let's Encrypt ACME challenge
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

# --- Main HTTPS server -------------------------------------------------------
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;                          # Nginx ≥ 1.25.1 directive (older: listen 443 ssl http2)
    server_name example.com www.example.com;

    # --- TLS -----------------------------------------------------------------
    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

    ssl_protocols       TLSv1.2 TLSv1.3;
    ssl_ciphers         ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256;
    ssl_prefer_server_ciphers off;     # Let TLS 1.3 clients pick

    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 1d;
    ssl_session_tickets off;           # Disable for forward secrecy

    ssl_stapling        on;
    ssl_stapling_verify on;
    resolver            1.1.1.1 8.8.8.8 valid=300s;
    resolver_timeout    5s;

    ssl_dhparam         /etc/nginx/ssl/dhparam.pem;  # openssl dhparam -out dhparam.pem 2048

    # --- Security headers ----------------------------------------------------
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Frame-Options           "SAMEORIGIN" always;
    add_header X-Content-Type-Options    "nosniff" always;
    add_header X-XSS-Protection          "1; mode=block" always;
    add_header Referrer-Policy           "strict-origin-when-cross-origin" always;
    add_header Permissions-Policy        "geolocation=(), microphone=(), camera=()" always;
    add_header Content-Security-Policy   "default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.example.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; connect-src 'self' https://api.example.com; frame-ancestors 'none';" always;

    # --- Gzip ----------------------------------------------------------------
    gzip              on;
    gzip_vary         on;
    gzip_proxied      any;
    gzip_comp_level   6;
    gzip_types        text/plain text/css text/xml text/javascript
                      application/json application/javascript application/xml+rss
                      application/atom+xml image/svg+xml;
    gzip_min_length   1024;

    # --- Logging -------------------------------------------------------------
    access_log /var/log/nginx/myapp.access.log combined buffer=4k flush=5s;
    error_log  /var/log/nginx/myapp.error.log warn;

    # --- Static assets with long-lived cache ---------------------------------
    location /static/ {
        alias /var/www/myapp/static/;
        expires 1y;
        add_header Cache-Control "public, immutable";
        access_log off;
    }

    # --- Rate-limited API endpoints ------------------------------------------
    location /api/auth/ {
        limit_req zone=login burst=10 nodelay;
        limit_req_status 429;
        proxy_pass http://app_backend;
        include /etc/nginx/proxy_params;
    }

    location /api/ {
        limit_req zone=api
Полный SKILL.md на GitHub

Установить nginx в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Write
Edit
Bash

FAQ

Что делает скилл nginx?

Nginx reverse proxy and web server configuration skill. USE WHEN: - Configuring Nginx as a reverse proxy in front of application servers (Node.js, Python, Ruby, Java) - Setting up HTTPS/TLS termination with certificates - Configuring virtual hosts, upstream load balancing, and rate limiting - Optimising static file serving, gzip compression, and cache headers - Adding security headers (HSTS, CSP, X-Frame-Options, X-Content-Type-Options) - Setting up WebSocket proxying - Diagnosing 502, 504, 413, or SSL handshake errors DO NOT USE FOR: - Application-level logic (belongs in the app server, not Nginx) - Container orchestration routing (use Kubernetes Ingress or a service mesh skill instead) - Full API gateway features (rate-limit-by-user, auth, JWT — use api-gateway skill) - Apache httpd configuration

Как установить скилл nginx?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nginx запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить nginx с