80 lines
2.6 KiB
Text
80 lines
2.6 KiB
Text
CONTEXTO — Tarea pendiente de completar (requiere sudo)
|
|
==========================================================
|
|
|
|
PROBLEMA
|
|
--------
|
|
El backend Node.js (api/app.js, puerto 8787) no está corriendo
|
|
y nginx no tiene el proxy /api/ configurado. Esto causa que:
|
|
- El botón "Enviar solicitudes GDPR" del panel principal dé error de conexión
|
|
- El egosurfing real (/api/egosearch) tampoco funcione
|
|
|
|
LO QUE YA ESTÁ HECHO
|
|
---------------------
|
|
1. Backend preparado: /var/www/resetea.net/api/app.js
|
|
2. .env creado: /var/www/resetea.net/api/.env (con SALT generado)
|
|
3. Seguridad egosearch mejorada (sanitización, validación URLs, límite tamaño)
|
|
4. Config nginx correcta preparada en: /tmp/resetea-nginx.conf
|
|
5. Servicio systemd preparado en: /tmp/resetea-api.service
|
|
|
|
LO QUE FALTA (necesita sudo)
|
|
-----------------------------
|
|
Comando 1 — Activar proxy nginx:
|
|
sudo cp /tmp/resetea-nginx.conf /etc/nginx/sites-enabled/resetea.net && sudo nginx -t && sudo systemctl reload nginx
|
|
|
|
Comando 2 — Arrancar backend como servicio:
|
|
sudo cp /tmp/resetea-api.service /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl enable --now resetea-api
|
|
|
|
Comando 3 — Verificar:
|
|
sudo systemctl status resetea-api
|
|
curl -s http://127.0.0.1:8787/api/health
|
|
|
|
CONTENIDO DE /tmp/resetea-nginx.conf
|
|
--------------------------------------
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name resetea.net;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name resetea.net;
|
|
root /var/www/resetea.net/public;
|
|
index index.html;
|
|
ssl_certificate /etc/letsencrypt/live/resetea.net/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/resetea.net/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:8787;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_read_timeout 15s;
|
|
proxy_connect_timeout 5s;
|
|
}
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
}
|
|
|
|
CONTENIDO DE /tmp/resetea-api.service
|
|
---------------------------------------
|
|
[Unit]
|
|
Description=RESETEA.NET API Backend
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=capitansito
|
|
WorkingDirectory=/var/www/resetea.net/api
|
|
ExecStart=/home/capitansito/.nvm/versions/node/v18.20.8/bin/node app.js
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
Environment=NODE_ENV=production
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|