WordPress – Blank pages and 200 http response on Debian using Nginx and php5

I’m trying to start a WordPress site on my Debian server, using Nginx and php5. I followed different tutorials but stuck : the server is responding 200 http responses to any url typed from the domain name, mes-affaires doot xyz . My browser is showing a blank page, but no error too.

As the server is responding 200 responses I’m not getting any error log in the Nginx log files which is a problem to know what to do.

Read More

Any idea why it’s showing a blank screen or how I could spot the current error?

Thanks

Related posts

1 comment

  1. Your problem can be caused by many factors:

    1. A poorly configured nginx (Read Configuring Nginx)

    2. A permission problem (Read step 5 of Configuring Nginx)

    3. A missing php module that you can find out enabling PHP error_reporting (Read Pages are still blank? Php error_reporting
    September)

    Configuring Nginx

    Nginx works a little differently from Apache and if you do not use a management panel, the procedure is a bit complicated.

    1. sudo apt-get install nginx php5-fpm mysql mysql-dev next activate mysql sudo mysql_install_dband run the setup script sudo /usr/bin/mysql_secure_installation

    2. Create a folder in /var/www with your site name (mkdir mess-affaires)

    3. go to /etc/nginx/sites-available and create a file with the same name as your domain (touch mess-affaires.xyz)

    4. Open your new file with an editor (nano mess-affaires.xyz) and add these lines:

    server {
        listen 80;
        root /var/www/mess-affaires;
        index index.html index.htm index.php;
        server_name www.mess-affaires.xyz mess-affaires.xyz;
        location / {
            try_files $uri $uri/ /index.php?q=$request_uri;
        }
        location ~ .php$ {
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_index index.php;
            include fastcgi_params;
        }
    }
    

    4.1. After this you need to link it to your sites-enabled folder using:

    sudo ln -s /etc/nginx/sites-available/mess-affaires.xyz /etc/nginx/sites-enabled/mess-affaires.xyz
    

    Nginx set a default file for example in your sites-available, delete it to avoid the “conflicting server name error”:

    sudo rm /etc/nginx/sites-enabled/default
    

    4.2. Restart your nginx installation with sudo service nginx restart

    5. Set permission to your folder sudo chown -R www-data:www-data /var/www/mess-affaires/ and make sure that everyone is able to read your new files sudo chmod 755 /var/www o to your folder /var/www/mess-affaires and upload the wordpress installation, now you see the website.

    If you still don’t see anything, see the point 6

    6. If you do not see anything, go to your terminal and type:

    chmod -R 777 /var/www/mess-affaires
    

    Configuring mysql/phpmyadmin with nginx

    WordPress is a web application that require a mysql database, go to install it!

    1. sudo apt-get install phpmyadmin

    2. sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html

    3. Now we must now allow the mcrypt module in php sudo php5enmod mcrypt

    4. restart phpfpm sudo service php5-fpm restart

    5. visit http://YOUR_SERVER_IP/phpmyadmin, log-in and create a new database for your wordpress installation

    Pages are still blank? Set php error_reporting

    If your pages are still blank, enable php error_reporting.

    To do this you can try two ways:

    Set error_reporting from your php files

    Open your WordPress index.php and put these lines to the very top of your page (after

    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', 1);
    

    Set error_reporting from php5-fpm.conf

    Open with an editor your php5-fpm-conf, try one of these directories:

    /etc/php-fpm.d/mydomain.conf
    /etc/php-fpm.conf
    

    If you sing my guide, you have not the native php installation but php5-fpm and you can configure your .conf file error params like this:

    ; enable display of errors
    php_flag[display_errors] = on
    php_flag[display_startup_errors] = on
    

    If you use a native php installation, set your config error_reporting like this:

    ; enable display of errors
    display_errors = On
    display_startup_errors = On
    

Comments are closed.