Nginx Server Block For WordPress With LetsEncrypt SSL

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;
    }
}

Subscribe

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

You've successfully subscribed to Salehin Khan
Great! Next, complete checkout for full access to Salehin Khan
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.