NginX + PHP-FPM displays blank php pages
According to your configuration, you have two server{...}
blocks which are exactly the same. So before I start explain what's wrong with your configuration, you need to provide more details. See down below for some troubleshooting hints.
For now, I'll post mine here and highlight a few directives
that do matter.
My /etx/nginx/conf.d/default.conf
looks as follow
server {
# Replace this port with the right one for your requirements
listen 80;
# Multiple hostnames separated by spaces. Replace these as well.
server_name mydomain.nl;
root /var/www/mydomain.nl/public_html/;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php index.html;
location / {
# This is cool because no php is touched for static content.
try_files $uri $uri/ /index.php;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
expires max;
}
location ~* \.php$ {
try_files $uri =404
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location ~ /\.(ht|ssh) {
deny all;
}
location /status {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
The following directives are important:
server_name mydmaiin.nl;
<-- This is unique for every server block.
root /var/www/mydomain.nl/public_html/;
<-- This is the root that holds your website / data.
The rest is trivial.
So Let's take the /etc/php-fpm.d/www.conf
file and examine. You chose to use a file socket
listen = /var/run/php-fpm/php-fpm.sock
<-- php-fpm will communicate with nginx
through this file. So this is my www.conf
file unless you missed something. I've filtered out all commented lines. So these are the lines that are uncommented.
[www]
listen = /var/run/php5-fpm.sock
listen.allowed_clients = 127.0.0.1
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
user = apache
group = apache
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
slowlog = /var/log/php-fpm/www-slow.log
security.limit_extensions = .php
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
Troubleshooting
1) See directory permissions. In this case /usr/share/nginx/html
2) See php-fpm error logging. See if the configuration file is loading OK, by running
php-fpm -y /etc/php-fpm.conf
3) Change log_level = debug
in /etc/php-fpm.conf
4) Come back with more details!