Wordpress on Vestacp with nginx + php-frm ( SSL certificate from Let's Encrypt) giving 500 Internal Server Error

September 11, 2018 1.3k views
Nginx WordPress DigitalOcean LEMP Ubuntu 16.04

If i remove WordPress and place a simple HTML file it works fine but when i remove it and place WordPress it gives internal server error. And auto redirect of http to https is also not working. I’ve worked with apache2 server in LAMP stack and it works fine with it but its my first time with LEMP stack. Am i doing something wrong??

I searched online about the problem and found a solution that nginx conf file should be modified and my both problems are gone but it did not work.

Here is the aipantomath.com.nginx.conf file that i edited from /home/admin/conf/web/

server {
    listen 80;
    listen [::]:80;
    server_name aipantomath.com www.aipantomath.com;

    return 301 https://$host$request_uri;

server {
    listen 443;
    listen [::]:443;
    server_name aipantomath.com www.aipantomath.com;
    root        /home/admin/web/aipantomath.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/aipantomath.com.log combined;
    access_log  /var/log/nginx/domains/aipantomath.com.bytes bytes;
    error_log   /var/log/nginx/domains/aipantomath.com.error.log error;

    location / {

        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;

         location / {
            try_files $uri $uri/ /index.php?$args;

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;

            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   /home/admin/web/aipantomath.com/document_errors/;

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;

    location /vstats/ {
        alias   /home/admin/web/aipantomath.com/stats/;
        include /home/admin/conf/web/aipantomath.com.auth*;

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.aipantomath.com.conf*;

1 Answer


In such cases what I usually recommend is:

  • First, run an Nginx config test to see if your config is OK:
nginx -t
  • If you get Syntax OK then the config is not the problem if there is a problem with the config you would see an error and you could further investigate based on the error
  • If there are no errors with the config, then check your error log:
tail -100 /var/log/nginx/error.log
  • You could also check the status of your Nginx:
systemctl status nginx

With all of the above information, you should be able to get to the bottom of the case.


Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!