server { root /var/www/epost; index index.php index.html index.htm; server_name epost.com.bd www.epost.com.bd; location / { try_files $uri $uri/ /index.php; } error_page 404 /custom_404.html; location = /custom_404.html { root /usr/share/nginx/html; internal; } error_page 500 502 503 504 /custom_50x.html; location = /custom_50x.html { root /usr/share/nginx/html; internal; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } if (!-e $request_filename) { rewrite ^.*$ /index.php last; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/epost.com.bd/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/epost.com.bd/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = www.epost.com.bd) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = epost.com.bd) { return 301 https://$host$request_uri; } # managed by Certbot server_name epost.com.bd www.epost.com.bd; listen 80; return 404; # managed by Certbot }