Un script automatizado para crear y configurar servidores web Nginx + PHP en contenedores LXC de Proxmox, perfecto para hospedar sitios web, aplicaciones PHP, WordPress, Laravel y servicios web sin complicaciones.
- 🐘 PHP-FPM opcional con versiones 8.1, 8.2 y 8.3
- 📦 Composer instalado globalmente
- ⚡ Configuración PHP optimizada para producción
- 🛠️ php-manager - Nueva herramienta de gestión PHP
- 🎨 Página de bienvenida dinámica con info del sistema en tiempo real
- 🔒 Security headers configurados por defecto
- Proxmox VE 8.x o 9.x
- Template LXC (Ubuntu 22.04/24.04 o Debian 12/13 - se detecta automáticamente)
- Acceso de red para el contenedor
- Dominio o IP para acceder al servidor web
# Ejecutar desde el HOST Proxmox (no desde un contenedor)
bash -c "$(wget -qO- https://raw.githubusercontent.com/MondoBoricua/nginx-server/master/auto-install.sh)"# Clonar el repositorio
git clone https://github.com/MondoBoricua/nginx-server.git
cd nginx-server
# Hacer ejecutable el instalador
chmod +x auto-install.sh
# Ejecutar instalación
./auto-install.sh¿Ya tienes un contenedor con Nginx? Puedes actualizarlo a la v3.0 con PHP:
# Ejecutar DENTRO del contenedor existente
bash -c "$(wget -qO- https://raw.githubusercontent.com/MondoBoricua/nginx-server/master/update.sh)"El script de actualización te permite:
- Instalar PHP en contenedor existente
- Actualizar herramientas de gestión
- Actualizar página de bienvenida
- Configurar Nginx para PHP
El instalador te guía paso a paso:
STEP 1/5: Verificando Entorno
STEP 2/5: Configuración del Contenedor
STEP 3/5: Recursos y Red
STEP 4/5: Configuración de PHP ← ¡NUEVO!
STEP 5/5: Confirmación
PHP Configuration
Recommended for most web applications
> Install PHP? [y/N]: y
Available PHP versions:
1) PHP 8.1 (LTS - stable)
2) PHP 8.2 (recommended)
3) PHP 8.3 (latest)
> PHP Version [2]: 2
[OK] PHP 8.2 selected
- 🔧 Instalación completamente automatizada
- 🌐 Nginx optimizado para producción
- 🔒 Security headers (X-Frame-Options, X-Content-Type-Options, X-XSS-Protection)
- 📁 Gzip compression habilitado
- 🚀 Static file caching (30 días)
- 🛡️ Bloqueo de archivos sensibles (.env, .log, .ini, .htaccess)
- PHP-FPM con versiones 8.1, 8.2, 8.3
- Módulos incluidos: mysql, pgsql, sqlite3, curl, gd, mbstring, xml, zip, bcmath, intl, opcache, soap, redis, imagick
- Composer instalado globalmente
- Configuración optimizada:
upload_max_filesize: 64Mpost_max_size: 64Mmemory_limit: 256Mmax_execution_time: 300s- OPcache habilitado
- 🔒 SSL/TLS con Let's Encrypt (Certbot)
- 🛡️ UFW Firewall configurado
- 🚫 Fail2ban protección contra ataques
- 🔑 expose_php = Off por seguridad
- 🔒 cgi.fix_pathinfo = 0 contra path traversal
nginx-info- Panel de información del servidornginx-manager- Gestión de sitios webssl-manager- Gestión de certificados SSLphp-manager- Gestión de PHP (nuevo!)
| Paquete | Descripción |
|---|---|
| Nginx | Servidor web principal |
| PHP-FPM | Procesamiento PHP (opcional) |
| Composer | Gestor de dependencias PHP |
| Certbot | Certificados SSL gratuitos |
| UFW | Firewall configurado |
| Fail2ban | Protección contra ataques |
| Git, Curl, Wget | Herramientas esenciales |
| htop, tree, nano | Utilidades de sistema |
nginx-info # Mostrar información del servidor
nginx-manager # Gestionar sitios web
nginx-status # Ver estado del servicio
nginx-test # Probar configuración
nginx-reload # Recargar configuración
nginx-restart # Reiniciar servicio
nginx-logs # Ver logs de acceso
nginx-errors # Ver logs de erroresphp-manager # Gestionar configuración PHP
php-status # Ver estado de PHP-FPM
php-restart # Reiniciar PHP-FPM
php-logs # Ver logs de PHP-FPM
composer # Gestor de dependenciasssl-manager # Gestionar certificados SSLNueva herramienta interactiva para gestionar PHP:
================================================
PHP Manager - v1.0
================================================
1) Show PHP info
2) Show installed modules
3) Restart PHP-FPM
4) View PHP-FPM status
5) Edit php.ini
6) View PHP-FPM logs
7) Clear OPcache
8) Update Composer
0) Exit
/var/www/html/ # Directorio web principal
/etc/nginx/ # Configuración Nginx
├── sites-available/ # Sitios disponibles
├── sites-enabled/ # Sitios habilitados
└── nginx.conf # Configuración principal
/etc/php/8.x/ # Configuración PHP
├── fpm/php.ini # PHP-FPM config
└── fpm/pool.d/www.conf # Pool config
/var/log/nginx/ # Logs de Nginx
/opt/nginx-server/ # Scripts de gestión
http://IP/- Página de bienvenida dinámica con info del sistemahttp://IP/info.php- phpinfo() completo
http://IP/- Página de bienvenida HTML estática
server {
listen 80;
server_name ejemplo.com www.ejemplo.com;
root /var/www/ejemplo.com/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}server {
listen 80;
server_name ejemplo.com www.ejemplo.com;
root /var/www/ejemplo.com;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}# Ejecutar ssl-manager
ssl-manager
# O directamente con certbot
certbot --nginx -d ejemplo.com -d www.ejemplo.compct enter [ID_CONTENEDOR]ssh root@IP_DEL_CONTENEDOR
# Contraseña por defecto: nginx123nginx -t # Verificar configuración
journalctl -u nginx -n 50 # Ver logs
systemctl restart nginx # Reiniciarphp-status # Ver estado
php-restart # Reiniciar
php-logs # Ver logschown -R www-data:www-data /var/www/
chmod -R 755 /var/www/php-manager # Opción 7
# O crear archivo para limpiar via webAl finalizar, verás un resumen como este:
==================================================================
|| [OK] INSTALLATION COMPLETED! ||
==================================================================
Container
├─ ID: 100
├─ Hostname: nginx-server
├─ IP: 192.168.1.100
├─ Password: nginx123
└─ Template: local:vztmpl/ubuntu-24.04...
Software
├─ [OK] Nginx
├─ [OK] PHP 8.2 (PHP-FPM)
└─ [OK] Composer
Features
├─ [OK] Autoboot enabled
├─ [OK] Autologin configured
└─ [OK] Service running
Web Server Access
├─ http://192.168.1.100
└─ http://192.168.1.100/info.php (PHP Info)
¿Encontraste un bug o tienes una mejora?
- Haz fork del repositorio
- Crea tu rama de feature (
git checkout -b feature/mejora-increible) - Commit tus cambios (
git commit -am '🚀 Añade mejora increíble') - Push a la rama (
git push origin feature/mejora-increible) - Crea un Pull Request
Este proyecto está bajo la Licencia MIT - ve el archivo LICENSE para más detalles.
Si este script te ayudó, ¡dale una estrella al repo! ⭐
Desarrollado en 🇵🇷 Puerto Rico con mucho ☕ café para la comunidad de Proxmox
Basado en el exitoso proyecto proxmox-samba