Plugins: automacao, crm-ops, design-media, dev-tools, gestao, infraestrutura, marketing, negocio, perfex-dev, project-manager, wordpress + hello-plugin (existente). Totais: 83 skills, 44 agents, 12 datasets.json Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
260 lines
5.6 KiB
Markdown
260 lines
5.6 KiB
Markdown
---
|
|
name: cwp-webserver
|
|
description: CWP webserver management with official API. Apache, Nginx, rebuild configurations, restart services. Based on official CWP documentation only. Use when user mentions "apache cwp", "nginx cwp", "webserver cwp", "vhost cwp".
|
|
author: Descomplicar® Crescimento Digital
|
|
version: 1.0.0
|
|
quality_score: 70
|
|
user_invocable: true
|
|
desk_task: null
|
|
---
|
|
|
|
# /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)
|
|
|
|
---
|
|
|
|
## 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
|