commit 47460f3faf85f367c9c4ba76760ea1a377ea95ed Author: Manuel Cabezas Date: Sat Dec 6 03:12:28 2025 -0300 feat: initial project setup diff --git a/README.md b/README.md new file mode 100644 index 0000000..25148c3 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Configuraciones Nginx - Sitio Ruteo + +## Estructura +- `sites-available/` → Configuraciones completas de sitios +- `conf.d/` → Configuraciones específicas de aplicaciones +- `ssl/` → Notas y documentación de certificados \ No newline at end of file diff --git a/ruteo-sanpabloalimentos-cl.md b/ruteo-sanpabloalimentos-cl.md new file mode 100644 index 0000000..2f8d654 --- /dev/null +++ b/ruteo-sanpabloalimentos-cl.md @@ -0,0 +1,64 @@ +# **Proxy Reverso** +### **etc/nginx/sites-available/ruteo.sanpabloalimentos.cl** +```nginx +# Template para sitio estático con proxy inverso +server { + listen 80; + server_name subdomain.domain.com; + + location / { + proxy_pass http://127.0.0.1:3000; + 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_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400; + } +} +``` +### **Archivo después de aplicar SSL con Certbot** +```nginx +server { + server_name subdomain.domain.com; + + location / { + proxy_pass http://127.0.0.1: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; + } + + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/subdomain.domain.com/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/subdomain.domain.com/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 = subdomain.domain.com) { + return 301 https://$host$request_uri; + } # managed by Certbot + + listen 80; + server_name subdomain.domain.com; + return 404; # managed by Certbot +} +``` +# **Servidor Web** +### **etc/nginx/conf.d/ruteo.conf** +```nginx +server { + listen 3000; + + location / { + root /var/www/html/ruteo/; + index index.html index.htm; + try_files $uri $uri/ /index.html =404; + } +} +``` \ No newline at end of file