- All SKILL.md files now <500 lines (avg reduction 69%) - Detailed content extracted to references/ subdirectories - Frontmatter standardised: only name + description (Anthropic standard) - New skills: brand-guidelines, spec-coauthor, report-templates, skill-creator - Design skills: anti-slop guidelines, premium-proposals reference - Removed non-standard frontmatter fields (triggers, version, author, category) Plugins affected: infraestrutura, marketing, dev-tools, crm-ops, gestao, core-tools, negocio, perfex-dev, wordpress, design-media Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
269 lines
6.0 KiB
Markdown
269 lines
6.0 KiB
Markdown
---
|
|
name: cwp-webserver
|
|
description: Gestão de webservers no CWP — configuração de Apache, Nginx, rebuild de vhosts e restart de serviços via API oficial.
|
|
disable-model-invocation: true
|
|
---
|
|
|
|
# /cwp-webserver - WebServers CWP (Documentação Oficial)
|
|
|
|
Gestão de webservers no CWP. **Zero assumptions, zero hallucinations** - apenas comandos documentados.
|
|
|
|
**REGRA #38 - ZERO INVENCAO:** NUNCA improvisar comandos. Verificar estado actual ANTES de alterar. Pesquisar wiki CWP se necessario. Usar APENAS scripts oficiais.
|
|
|
|
---
|
|
|
|
## Servidor Alvo
|
|
|
|
| Servidor | IP | MCP | User |
|
|
|----------|-----|-----|------|
|
|
| **CWP Principal** | 176.9.3.158 | ssh-unified | root |
|
|
|
|
---
|
|
|
|
## Documentação Base
|
|
|
|
- [CWP Admin API](https://wiki.centos-webpanel.com/cwp-admin-api)
|
|
- [CWP Scripts](https://wiki.centos-webpanel.com/cwp-scripts)
|
|
- [WebServers Update](https://wiki.centos-webpanel.com/webservers-update)
|
|
|
|
### Documentação Hub (Consultar SEMPRE)
|
|
|
|
**Manuais locais** (`Hub/06-Operacoes/Documentacao/Manuais/CWP/`):
|
|
- `CWP-Manual-Completo.md` - Admin Guide (seccao WebServers Settings, Apache, Nginx) + Wiki (WebServers & Apache) - **503KB**
|
|
- `CWP-Guia-do-Utilizador.md` - Painel utilizador (seccao Domains, Redirect) - **72KB**
|
|
|
|
**Quick Reference:** `Hub/06-Operacoes/Documentacao/Quick-Reference/QR-CWP.md`
|
|
|
|
**NotebookLM (pesquisa AI sobre toda a documentacao CWP):**
|
|
```
|
|
mcp__notebooklm__notebook_query notebook_id:"0ded7bd6-69b3-4c76-b327-452396bf7ea7" query:"apache nginx webserver configuracao rebuild"
|
|
```
|
|
|
|
---
|
|
|
|
## API WebServers (Documentada)
|
|
|
|
### Rebuild Todas as Configurações
|
|
|
|
```bash
|
|
/scripts/cwp_api webservers rebuild_all
|
|
```
|
|
|
|
### Rebuild Configuração de Utilizador
|
|
|
|
```bash
|
|
/scripts/cwp_api webservers rebuild_user USERNAME
|
|
```
|
|
|
|
### Restart WebServers
|
|
|
|
```bash
|
|
/scripts/cwp_api webservers restart
|
|
```
|
|
|
|
### Reload WebServers
|
|
|
|
```bash
|
|
/scripts/cwp_api webservers reload
|
|
```
|
|
|
|
---
|
|
|
|
## Scripts Oficiais
|
|
|
|
| Script | Descrição |
|
|
|--------|-----------|
|
|
| `/scripts/restart_httpd` | Restart Apache |
|
|
| `/scripts/cwpsrv_rebuild_user_conf` | Rebuild config de todos os utilizadores |
|
|
| `/scripts/varnish_clear_cache` | Limpar cache Varnish |
|
|
| `/scripts/apache_mpm_calculator` | Gerar configuração Apache MPM |
|
|
|
|
---
|
|
|
|
## Comandos de Gestão
|
|
|
|
### Restart Apache
|
|
|
|
```bash
|
|
sh /scripts/restart_httpd
|
|
```
|
|
|
|
### Rebuild Configurações de Utilizadores
|
|
|
|
```bash
|
|
sh /scripts/cwpsrv_rebuild_user_conf
|
|
```
|
|
|
|
### Limpar Cache Varnish
|
|
|
|
```bash
|
|
sh /scripts/varnish_clear_cache
|
|
```
|
|
|
|
### Gerar Configuração MPM
|
|
|
|
```bash
|
|
sh /scripts/apache_mpm_calculator
|
|
```
|
|
|
|
---
|
|
|
|
## Verificações
|
|
|
|
### Status Apache
|
|
|
|
```bash
|
|
systemctl status httpd --no-pager | head -15
|
|
```
|
|
|
|
### Status Nginx
|
|
|
|
```bash
|
|
systemctl status nginx --no-pager | head -15
|
|
```
|
|
|
|
### Testar Configuração Apache
|
|
|
|
```bash
|
|
httpd -t
|
|
```
|
|
|
|
### Testar Configuração Nginx
|
|
|
|
```bash
|
|
nginx -t
|
|
```
|
|
|
|
### Ver Virtual Hosts
|
|
|
|
```bash
|
|
httpd -S 2>&1 | grep -E 'port|namevhost' | head -20
|
|
```
|
|
|
|
---
|
|
|
|
## Workflows
|
|
|
|
### 1. Rebuild Completo (Problema de Configuração)
|
|
|
|
```bash
|
|
# Rebuild todas as configs
|
|
/scripts/cwp_api webservers rebuild_all
|
|
|
|
# Restart
|
|
/scripts/cwp_api webservers restart
|
|
```
|
|
|
|
### 2. Rebuild Utilizador Específico
|
|
|
|
```bash
|
|
# Rebuild apenas um utilizador
|
|
/scripts/cwp_api webservers rebuild_user USERNAME
|
|
|
|
# Reload (sem downtime)
|
|
/scripts/cwp_api webservers reload
|
|
```
|
|
|
|
### 3. Após Alterações em Site
|
|
|
|
```bash
|
|
# Reload (mais suave)
|
|
/scripts/cwp_api webservers reload
|
|
```
|
|
|
|
### 4. Limpar Cache Varnish (Se Activo)
|
|
|
|
```bash
|
|
sh /scripts/varnish_clear_cache
|
|
```
|
|
|
|
### 5. Verificar Antes de Restart
|
|
|
|
```bash
|
|
# Testar configurações primeiro
|
|
httpd -t && nginx -t
|
|
|
|
# Se OK, restart
|
|
/scripts/cwp_api webservers restart
|
|
```
|
|
|
|
---
|
|
|
|
## REGRA FUNDAMENTAL: ZERO INVENCAO (Regra #38)
|
|
|
|
**NUNCA improvisar comandos para Apache/Varnish/Nginx/PHP no CWP.**
|
|
|
|
Protocolo obrigatorio ANTES de qualquer accao:
|
|
1. **VERIFICAR** estado actual (systemctl status, logs, config activa)
|
|
2. **PESQUISAR** skills /cwp-* para comandos oficiais
|
|
3. **PESQUISAR** wiki CWP se skill nao cobre o caso
|
|
4. **USAR** apenas scripts oficiais CWP (/scripts/*)
|
|
5. **NUNCA** inventar comandos, flags, ou configuracoes
|
|
|
|
Se nao encontra o comando correcto: **PERGUNTAR ao utilizador**, nunca adivinhar.
|
|
|
|
Exemplos de invencao proibida:
|
|
- Editar ficheiros de config Apache directamente em vez de usar rebuild
|
|
- Inventar flags para apachectl que nao estao documentadas
|
|
- Alterar parametros de sistema (sysctl, somaxconn) sem pesquisar impacto
|
|
- Matar processos (kill -9) sem entender o que esta a correr
|
|
- Desactivar modulos/servicos sem confirmar dependencias
|
|
|
|
---
|
|
|
|
## Anti-Patterns (NUNCA FAZER)
|
|
|
|
| Anti-Pattern | Risco | Alternativa |
|
|
|--------------|-------|-------------|
|
|
| Inventar comandos | PHP desactivado, site offline | Pesquisar skills/wiki primeiro |
|
|
| Restart sem testar config | Downtime | `httpd -t` primeiro |
|
|
| Editar vhosts manualmente | Sobrescrito | Usar CWP ou rebuild |
|
|
| Ignorar erros de teste | Site offline | Corrigir antes restart |
|
|
| Restart em vez de reload | Downtime | Reload quando possível |
|
|
| Alterar sysctl sem pesquisar | Instabilidade | Verificar documentacao |
|
|
| kill -9 em processos CWP | Servicos corrompidos | Usar scripts oficiais |
|
|
|
|
---
|
|
|
|
## Diferença Restart vs Reload
|
|
|
|
| Operação | Efeito | Quando Usar |
|
|
|----------|--------|-------------|
|
|
| **Reload** | Recarrega config sem parar | Alterações pequenas |
|
|
| **Restart** | Para e inicia novamente | Alterações grandes, módulos |
|
|
|
|
---
|
|
|
|
## Validação Pós-Operação
|
|
|
|
```bash
|
|
# 1. Verificar serviços activos
|
|
systemctl is-active httpd nginx
|
|
|
|
# 2. Testar localhost
|
|
curl -sI localhost | head -5
|
|
|
|
# 3. Testar domínio específico
|
|
curl -sI http://DOMINIO | head -5
|
|
|
|
# 4. Verificar logs de erro
|
|
tail -20 /var/log/httpd/error_log
|
|
tail -20 /var/log/nginx/error.log
|
|
```
|
|
|
|
---
|
|
|
|
## Checklist de Execução
|
|
|
|
- [ ] Testar configuração (`httpd -t`, `nginx -t`)
|
|
- [ ] Escolher reload vs restart
|
|
- [ ] Executar comando
|
|
- [ ] Verificar serviços activos
|
|
- [ ] Testar acesso aos sites
|
|
- [ ] Verificar logs se problemas
|
|
|
|
---
|
|
|
|
**Versão:** 1.0.0 | **Autor:** Descomplicar®
|
|
**Fonte:** wiki.centos-webpanel.com/cwp-admin-api, wiki.centos-webpanel.com/cwp-scripts
|