Notas de Luis

¡Esta es una revisión vieja del documento!


Instalación de Wordpress

Instalar PHP

Instalar PHP 8.4 mediante el repositorio de Ondrej (el estándar de facto en Ubuntu para tener versiones recientes de PHP), ya que es la versión más estable y compatible actualmente con WordPress y sus plugins.

sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install php8.4-fpm php8.4-mysql php8.4-xml php8.4-mbstring php8.4-curl php8.4-zip php8.4-gd php8.4-intl -y

Instalar mariadb

sudo apt install mariadb mycli
CREATE DATABASE wordpress_db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'TU_CONTRASEÑA_SEGURA';
CREATE USER 'ubuntu'@'localhost' IDENTIFIED BY 'TU_CONTRASEÑA_SEGURA';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'ubuntu'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Instalar wordpress

Instalamos en pruebawewelinapmu.my.to, haciendo copia de lo existente.

cd /tmp
wget https://es.wordpress.org/latest-es_ES.tar.gz
tar -xzf latest-es_ES.tar.gz
sudo mv /var/www/pruebaewelinapmu /var/www/pruebaewelinapmu_flask_backup
sudo mv wordpress /var/www/pruebaewelinapmu
sudo chown -R www-data:www-data /var/www/pruebaewelinapmu
sudo find /var/www/pruebaewelinapmu -type d -exec chmod 755 {} \;
sudo find /var/www/pruebaewelinapmu -type f -exec chmod 644 {} \;
rm latest-es_ES.tar.gz

Configuramos nginx - wordpress

Editamos el fichero /etc/nginx/sites-available/pruebaewelinapmu.

server {
    listen 80;
    server_name pruebaewelinapmu.my.to;
 
    root /var/www/pruebaewelinapmu;
    index index.php index.html;
 
    access_log /var/log/nginx/pruebaewelinapmu.access.log;
    error_log /var/log/nginx/pruebaewelinapmu.error.log;
 
    # Detectar si el reverse proxy (gimli) envía HTTPS
    set $fastcgi_https off;
    if ($http_x_forwarded_proto = https) {
        set $fastcgi_https on;
    }
 
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
 
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.4-fpm.sock;
        fastcgi_param HTTPS $fastcgi_https;
    }
 
    # Denegar acceso a archivos ocultos (como .htaccess)
    location ~ /\.ht {
        deny all;
    }
 
    # Denegar acceso a archivos sensibles de WordPress
    location ~* /(?:xmlrpc\.php|wp-config\.php|readme\.html|license\.txt) {
        deny all;
    }
}
sudo nginx -t
sudo systemctl reload nginx
computing/web/wordpress_install.1783093178.txt.gz · Última modificación: por alfabeto