Website displaying blank page after Upgrading Ubuntu Server

September 9, 2014 7k views

Hello,
I have a Ubuntu 14.04 server with LEMP Stack and vargrant installed. My website runs on wordpress.
My website was running fine. When I did ssh login to my server, the server displayed that there are some Security Updates available.
So I Upgraded the server:

sudo apt-get update;
sudo apt-get upgrade;

During the Upgrade it asked whether to install a new configuration for nginx or keep the remaining one. I typed 'N'.
The upgrade went fine.

But when I access my website, it is displaying the blank page.

I ran the following command too:

sudo nginx -t

I get the following message:

nginx: [warn] server name "http://domain.com" has suspicious symbols in /etc/nginx/sites-enabled/domain:29
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Please help me out.

Thanks,
Tushar

4 comments
2 Answers

Are you using PHP-FPM?

Try adding this to your config:

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

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
  • Hi.
    Here is the link to my full config file. Have a look at it.

    Full Config File

    Thanks

  •         location ~ \.php$ {
                    try_files $uri =404;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
            #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
            #
            #       # With php5-cgi alone:
            #       fastcgi_pass 127.0.0.1:9000;
            #       # With php5-fpm:
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    include fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            }
    

    Try adding that additional line and see if it works.

    Make sure to sudo service nginx reload

    Check out this bug report: https://bugs.launchpad.net/nginx/+bug/1366651

    • That worked for me, thanks! I've followed the steps on how-to-install-wordpress-with-nginx-on-ubuntu-14-04 and it doesn't indicate that last line, which by the way was preventing php-fpm from executing. I've lost a couple hours trying a few workarounds with no avail. The tutorial should definitely be updated to accommodate this specific scenario.

      by Justin Ellingwood
      WordPress is the most popular CMS (content management system) in the world. It can be used to get your site or blog off the ground quickly and it provides a nice interface for adding content and modifying the site's design. In this guide, we'll walk through how to install WordPress on Ubuntu 14.04 with an Nginx web server.
  • Thank you Very much. You are a genius. It helped.

    The following line was missing:

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    

    But it was working well without the line before updating.
    Do you mind telling me the reason ?

    Thanks a lot.

  • Prior to the update, /etc/nginx/fastcgi_params had a SCRIPT_FILENAME parameter.

    However, the update removed that line and killed a lot of php-fpm sites. A more permanent solution is to change your config from this:

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    #       # With php5-cgi alone:
    #       fastcgi_pass 127.0.0.1:9000;
    #       # With php5-fpm:
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    

    to this:

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    #       # With php5-cgi alone:
    #       fastcgi_pass 127.0.0.1:9000;
    #       # With php5-fpm:
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
    }
    
  • You mean to say, the better and permanent solution to resolve the issue is to
    Remove the line:

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    

    and replace it with

    include fastcgi.conf
    

    Isn't it?

  • Correct, but also remove include fastcgi_params;

    Before you do that, check that /etc/nginx/fastcgi.conf exists and that the fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; line is in it.

    edit: also, don't forget the semi-colon on include fastcgi.conf;

  • Thank you. It helped too.
    You are a real life saver.

    Have a good day.

Hello all. After updating/upgrading nginx and my ubuntu 14.04, this happened to one of my sites. What worked for me was placing "fastcgiparam SCRIPTFILENAME $documentroot$fastcgiscript_name;" at the end of my location block. Afterwards, I ran sudo service nginx restart and it was back up. Here is my whole config for reference

server {
        listen 80;
    listen [::]:80;

        ## root /var/www/great-create.com/public_html/nodejs/project;
        root /var/www/great-create.com/public_html;
        index index.php index.html index.htm;

        server_name great-create.com www.great-create.com;
        ## server_name localhost;

        #location / {
        # try_files $uri $uri/ =404;
#}


 location ~ \.php$ {
 try_files $uri =404;
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
 fastcgi_pass unix:/var/run/php5-fpm.sock;
 fastcgi_index index.php;
 include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 }

location /dev {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection ‘upgrade’;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
}



}
Have another answer? Share your knowledge.