Wordpress Nginx configuration

nano /etc/nginx/sites-available/wordpress.conf

server {  
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.example.com example.com;
    set $homepage_url https://www.example.com;

    if ($host = "example.com") {
        return 301 $homepage_url$request_uri;
    }

    if ($scheme = "http") {
        return 301 $homepage_url$request_uri;
    }

    # charset utf-8;

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

    ssl_certificate crts/www.example.com.pem;
    ssl_certificate_key crts/www.example.com.key;

    include error-pages.conf;

    location ~* \.(css|woff|woff2|svg|svgz|js|jpg|jpeg|gif|png|pdf|mp4) {
        include static.conf;
    }

    location ~* /(\.ht|readme\.html|license\.txt) {
        return 403;
        expires max;
    }

    location ~ /(wp-login\.php|wp-admin/.+\.php|wp-content/plugins/ari-adminer/.+\.php)$ {
        include firewall.conf;
        include php-fpm.conf;
    }

    location ~ \.php$ {
        include php-fpm.conf;
    }

    location / {
        # WORDPRESS
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

}

ln -s /etc/nginx/sites-available/wordpress.conf /etc/nginx/sites-enabled/wordpress.conf