=== PUBLIC IP ===
31.97.147.114=== LISTENING PORTS ===
Netid State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess                                                                                                                     
udp   UNCONN 0      0         127.0.0.54:53         0.0.0.0:*    users:(("systemd-resolve",pid=171627,fd=16))                                                                               
udp   UNCONN 0      0      127.0.0.53%lo:53         0.0.0.0:*    users:(("systemd-resolve",pid=171627,fd=14))                                                                               
tcp   LISTEN 0      128          0.0.0.0:5007       0.0.0.0:*    users:(("python",pid=839321,fd=4))                                                                                         
tcp   LISTEN 0      2048         0.0.0.0:5003       0.0.0.0:*    users:(("gunicorn",pid=890973,fd=3),("gunicorn",pid=171697,fd=3),("gunicorn",pid=171695,fd=3),("gunicorn",pid=171694,fd=3))
tcp   LISTEN 0      70         127.0.0.1:33060      0.0.0.0:*    users:(("mysqld",pid=171717,fd=21))                                                                                        
tcp   LISTEN 0      511          0.0.0.0:443        0.0.0.0:*    users:(("nginx",pid=171608,fd=10),("nginx",pid=171607,fd=10),("nginx",pid=171606,fd=10))                                   
tcp   LISTEN 0      128        127.0.0.1:5002       0.0.0.0:*    users:(("python",pid=355105,fd=6),("python",pid=355105,fd=5),("python",pid=355095,fd=5))                                   
tcp   LISTEN 0      4096         0.0.0.0:22         0.0.0.0:*    users:(("sshd",pid=171611,fd=3),("systemd",pid=1,fd=167))                                                                  
tcp   LISTEN 0      511          0.0.0.0:80         0.0.0.0:*    users:(("nginx",pid=171608,fd=9),("nginx",pid=171607,fd=9),("nginx",pid=171606,fd=9))                                      
tcp   LISTEN 0      200        127.0.0.1:5432       0.0.0.0:*    users:(("postgres",pid=171647,fd=7))                                                                                       
tcp   LISTEN 0      4096   127.0.0.53%lo:53         0.0.0.0:*    users:(("systemd-resolve",pid=171627,fd=15))                                                                               
tcp   LISTEN 0      151        127.0.0.1:3306       0.0.0.0:*    users:(("mysqld",pid=171717,fd=23))                                                                                        
tcp   LISTEN 0      4096      127.0.0.54:53         0.0.0.0:*    users:(("systemd-resolve",pid=171627,fd=17))                                                                               
tcp   LISTEN 0      511                *:5001             *:*    users:(("node /var/www/p",pid=171674,fd=19))                                                                               
tcp   LISTEN 0      4096            [::]:22            [::]:*    users:(("sshd",pid=171611,fd=4),("systemd",pid=1,fd=168))                                                                  
tcp   LISTEN 0      511                *:3001             *:*    users:(("node /var/www/s",pid=984,fd=20))                                                                                  
tcp   LISTEN 0      511                *:3000             *:*    users:(("node",pid=1041,fd=18))                                                                                            
tcp   LISTEN 0      200            [::1]:5432          [::]:*    users:(("postgres",pid=171647,fd=6))                                                                                       
=== NGINX SITES ENABLED ===
total 8
drwxr-xr-x 2 root root 4096 Jul 22 21:30 .
drwxr-xr-x 8 root root 4096 Jul 31 00:40 ..
lrwxrwxrwx 1 root root   40 Jul 22 21:30 cadastrounity -> /etc/nginx/sites-available/cadastrounity
lrwxrwxrwx 1 root root   36 May 28 03:05 meu_react -> /etc/nginx/sites-available/meu_react
lrwxrwxrwx 1 root root   43 Jun 11 15:16 projeto_personal -> /etc/nginx/sites-available/projeto_personal
lrwxrwxrwx 1 root root   37 Jun  1 01:23 site_unity -> /etc/nginx/sites-available/site_unity
server {
    if ($host = www.cadastrounity.com.br) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = cadastrounity.com.br) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name cadastrounity.com.br www.cadastrounity.com.br;

    # Redireciona tudo para HTTPS
    return 301 https://$server_name$request_uri;




}

server {
    listen 443 ssl http2;
    server_name cadastrounity.com.br www.cadastrounity.com.br;

    # Certificados SSL (Let's Encrypt)
    ssl_certificate /etc/letsencrypt/live/cadastrounity.com.br/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/cadastrounity.com.br/privkey.pem; # managed by Certbot
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    # Proxy para o Flask
    location / {
        proxy_pass http://127.0.0.1:5002/;
        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;
    }

    # Arquivos estáticos
    location /static/ {
        alias /var/www/cadastro_unity/unity_cadastro_social/static/;
        expires 30d;
        add_header Cache-Control "public, immutable";
    }

    access_log /var/log/nginx/cadastrounity_access.log;
    error_log /var/log/nginx/cadastrounity_error.log;


}
server {
    listen 80;
    server_name unitytech.org.br www.unitytech.org.br;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name unitytech.org.br www.unitytech.org.br;

    root /var/www/meu_react;
    index index.html;

    ssl_certificate /etc/letsencrypt/live/www.unitytech.org.br/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.unitytech.org.br/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
}
server {
    server_name jhenriqueteam.com.br www.jhenriqueteam.com.br;
    
    # Logs
    access_log /var/log/nginx/jhenriqueteam-access.log;
    error_log /var/log/nginx/jhenriqueteam-error.log;
    
    # Frontend React (porta 3000)
    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        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;
    }
    
    # Backend API (porta 5001)
    location /api {
        proxy_pass http://localhost:5001/;
        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;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/jhenriqueteam.com.br/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/jhenriqueteam.com.br/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = www.jhenriqueteam.com.br) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = jhenriqueteam.com.br) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name jhenriqueteam.com.br www.jhenriqueteam.com.br;
    return 404; # managed by Certbot




}
server {
    server_name unityinstituto.org.br www.unityinstituto.org.br;

    root /var/www/site_unity;
    index index.html;

    # ⭐ Aumentar limite de upload para 50MB
    client_max_body_size 50M;

    # ⭐ API Node.js
    location /api/ {
        proxy_pass http://localhost:3001/api/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        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;
    }

    # ⭐ Bloquear acesso à pasta actions (evitar 403)
    location ~ ^/actions(/|$) {
        try_files $uri $uri/ /index.html;
    }

    # ⭐ Uploads (fotos) - servidas diretamente
    location ^~ /uploads/ {
        alias /var/www/site_unity/server/uploads/;
        expires 30d;
        add_header Cache-Control "public, immutable";
    }

    # ⭐ Painel Admin (React)
    location /admin {
        try_files $uri $uri/ /index.html;
    }

    # Frontend
    location / {
        try_files $uri $uri/ /index.html;
    }

    # Cache de arquivos estáticos
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }

    gzip on;
    gzip_vary on;
    gzip_types text/plain text/css text/xml application/json application/javascript;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/unityinstituto.org.br/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/unityinstituto.org.br/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.unityinstituto.org.br) {
        return 301 https://$host$request_uri;
    }

    if ($host = unityinstituto.org.br) {
        return 301 https://$host$request_uri;
    }

    listen 80;
    server_name unityinstituto.org.br www.unityinstituto.org.br;
    return 404; # managed by Certbot
}
=== SYSTEMD SERVICES ===
  UNIT                        LOAD   ACTIVE SUB     DESCRIPTION
  cron.service                loaded active running Regular background program processing daemon
  dbus.service                loaded active running D-Bus System Message Bus
  fwupd.service               loaded active running Firmware update daemon
  gestao_projetos.service     loaded active running Sistema Gestao projetos Flask
  getty@tty1.service          loaded active running Getty on tty1
  ModemManager.service        loaded active running Modem Manager
  multipathd.service          loaded active running Device-Mapper Multipath Device Controller
  mysql.service               loaded active running MySQL Community Server
  nginx.service               loaded active running A high performance web server and a reverse proxy server
  pm2-root.service            loaded active running PM2 process manager
  polkit.service              loaded active running Authorization Manager
  postgresql@16-main.service  loaded active running PostgreSQL Cluster 16-main
  qemu-guest-agent.service    loaded active running QEMU Guest Agent
  rsyslog.service             loaded active running System Logging Service
  serial-getty@ttyS0.service  loaded active running Serial Getty on ttyS0
  ssh.service                 loaded active running OpenBSD Secure Shell server
  systemd-journald.service    loaded active running Journal Service
  systemd-logind.service      loaded active running User Login Management
  systemd-networkd.service    loaded active running Network Configuration
  systemd-resolved.service    loaded active running Network Name Resolution
  systemd-timesyncd.service   loaded active running Network Time Synchronization
  systemd-udevd.service       loaded active running Rule-based Manager for Device Events and Files
  udisks2.service             loaded active running Disk Manager
  unattended-upgrades.service loaded active running Unattended Upgrades Shutdown
  user@0.service              loaded active running User Manager for UID 0

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

25 loaded units listed.
=== RUNNING PROCESSES ===
root         753  0.0  0.2 110052 23200 ?        Ssl  Jul30   0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
root         918  0.0  0.8 1300740 69508 ?       Ssl  Jul30  12:33 PM2 v7.0.3: God Daemon (/root/.pm2)
root         984  0.1  0.8 1304460 71536 ?       Ssl  Jul30  27:50 node /var/www/site_unity/server/index.js
root        1041  0.0  1.4 1323672 114828 ?      Sl   Jul30   0:08 node /usr/bin/serve -s dist -l 3000
root      171606  0.0  0.0  22676  2844 ?        Ss   Aug01   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data  171607  0.0  0.1  26616 12524 ?        S    Aug01   0:26 nginx: worker process
www-data  171608  0.0  0.1  26452 12164 ?        S    Aug01   0:23 nginx: worker process
root      171674  0.2  0.8 1038180 72260 ?       Ssl  Aug01  23:28 node /var/www/projeto_personal/backend/server.js
root      171694  0.0  0.3 110796 26556 ?        Ssl  Aug01   1:48 /var/www/gestao_projetos/.venv/bin/python3 /var/www/gestao_projetos/.venv/bin/gunicorn --workers 3 --bind 0.0.0.0:5003 app:app
root      171695  0.0  0.9  95168 74584 ?        S    Aug01   0:11 /var/www/gestao_projetos/.venv/bin/python3 /var/www/gestao_projetos/.venv/bin/gunicorn --workers 3 --bind 0.0.0.0:5003 app:app
root      171697  0.0  0.9  95096 74596 ?        S    Aug01   0:11 /var/www/gestao_projetos/.venv/bin/python3 /var/www/gestao_projetos/.venv/bin/gunicorn --workers 3 --bind 0.0.0.0:5003 app:app
root      355095  0.3  1.7 482316 146356 ?       Sl   Aug03  34:15 python app.py
root      355105  1.2  2.6 846164 215892 ?       Sl   Aug03 111:56 /var/www/cadastro_unity/unity_cadastro_social/venv/bin/python app.py
root      839321  0.0  0.8 373896 69340 ?        S    Aug07   0:21 python run.py
root      890973  0.0  0.9 167360 74064 ?        S    Aug08   0:03 /var/www/gestao_projetos/.venv/bin/python3 /var/www/gestao_projetos/.venv/bin/gunicorn --workers 3 --bind 0.0.0.0:5003 app:app
=== WEB DIRECTORIES ===
total 48
drwxr-xr-x  9 root     root      4096 Aug  7 21:22 .
drwxr-xr-x 14 root     root      4096 May 11 18:26 ..
drwxr-xr-x  6 www-data www-data  4096 Aug  3 02:44 cadastro_unity
drwxr-xr-x 20 root     root      4096 Jun 15 20:15 gestao_projetos
drwxr-xr-x  3 root     root      4096 Jul  9 19:20 html
drwx---rwx 23 root     root     16384 May 29 21:13 meu_react
dr-x------  4 root     root      4096 Jun 11 14:33 projeto_personal
drwxr-xr-x 10 www-data www-data  4096 Jul 14 15:28 site_unity
drwx------  6 www-data www-data  4096 Aug  7 21:27 unity_eleitoral
total 12
drwxr-xr-x  3 root   root   4096 May  8 00:59 .
drwxr-xr-x 22 root   root   4096 Aug  9 05:49 ..
drwxr-x---  3 ubuntu ubuntu 4096 May  8 00:59 ubuntu
