Instalar WordPress sobre Nginx + php7 + MariaDB en Debian 9

# apt update && apt upgrade
# apt install mariadb-server php7.0 php7.0-fpm php7.0-mysql nginx wget nano certbot --no-install-recommends
# wget -O /var/www/wordpress.tar.gz https://wordpress.org/latest.tar.gz
# tar xfvz /var/www/wordpress.tar.gz -C /var/www/
# chown -R www-data:www-data /var/www/wordpress
# systemctl stop nginx
# certbot certonly --standalone -m correo@loquesea.com --agree-tos -d www.dominio.com

Ahora borramos todo lo que contenga /etc/nginx/sites-available/default y lo sustituimos por esto por ejemplo (utilizando nano o el editor que queramos y tengamos en el sistema instalado):

server {
        listen 80;
        listen [::]:80;
        server_name www.dominio.com;
        return  301 https://$server_name$request_uri;
}

server {
	listen 443 ssl http2 default_server;

        server_name www.dominio.com;
        charset utf-8;

        add_header Strict-Transport-Security "max-age=31536000;";
        add_header Pragma "no-cache";
        add_header Cache-Control "private, max-age=0, no-cache, no-store";

        ssl on;
        ssl_certificate /etc/letsencrypt/live/www.dominio.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/www.dominio.com/privkey.pem;

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
	ssl_prefer_server_ciphers  on;
	ssl_session_cache    shared:SSL:10m;
	ssl_session_timeout  24h;
	keepalive_timeout 300;

        access_log /var/log/nginx/www.dominio.com.es-access.log;
        error_log  /var/log/nginx/www.dominio.com-error.log;

        root /var/www/wordpress;
        index index.php index.html;

        location / {
		try_files $uri $uri/ /index.php?$args;
                error_page    404 = /404.php;
                fastcgi_intercept_errors on;
        }

        # Denegar el acceso a archivos como .htaccess, .htpasswd, .DS_Store (Mac).
        location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
        }

        location ~ \.php {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                error_page    404 = /404.php;
        }

        location ~* /(?:uploads|files)/.*\.php$ {
            deny all;
        }
        location ~ /wp-content/uploads/
        {
                add_header Cache-control "public";
                access_log   off;
                expires      90d;
        }

        location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$
        {
                add_header      Cache-control "public";
                expires         90d;
                access_log      off;
        }
	

}

Iniciamos nginx:

# systemctl start nginx

Creamos la base de datos, el usuario y la password:

# mariadb -u root
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> GRANT USAGE ON wordpress.* TO usuario@localhost IDENTIFIED BY '123456';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO usuario@localhost;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit

Esto podría estar en otra maquina y con password root en la base de datos pero para dejar esto escrito he preferido no liar.

Luego ya es conectarse con el navegador y finalizar la instalación del wordpress.

próximo Publicación

Atrás Publicación

Dejar una contestacion

© 2018 [ MIERDA TV ]

Tema de Anders Norén