Nginx Server Block For WordPress With LetsEncrypt SSL

Picture for the post Nginx Server Block For WordPress With LetsEncrypt SSL

Nginx server block for wordpress with LetsEncrypt SSL certificate.

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    root /var/www/blog.saleheen.xyz/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name blog.saleheen.xyz;
    include snippets/ssl-blog.saleheen.xyz.conf;
    include snippets/ssl-params.conf;
    client_max_body_size 40m;
    location / {
       #try_files $uri $uri/ =404;
       try_files $uri $uri/ /index.php$is_args$args;
    }
     location ~ /.well-known {
                allow all;
        }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
     location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|eot|otf|ttf|woff)$ {
        expires 30d;
        log_not_found off;
    }

    location ~ /\.ht {
        deny all;
    }
}