Nginx with PHP5-FPM -.php files displaying blank screens
I am banging my head against the wall trying to start nginx with php5-fpm. I felt like it was a small detail that I was looking through, so I took a break and came back to it a few days later. I stayed with him for a few more hours today to no avail.
Anyway, here's the problem: I have nginx running. It seems to be serving web pages correctly. for example, the basic website http://www.shidenadvanced.com only supports fine. However, the php test I have is at http://www.shidenadvanced.com/test.php returns as empty. It used to come back as 502 Bad Gateway.
In the course of my research, I was convinced that this means that he could not route correctly through php-fpm. It's not 100%.
This is my / sites-available / config:
server {
server_name www.shidenadvanced.com shidenadvanced.com;
access_log /srv/sites/shidenadvanced/logs/access.log;
error_log /srv/sites/shidenadvanced/logs/error.log;
root /srv/sites/shidenadvanced/www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
#location ~ \.php$ {
# try_files $uri =404;
# include /etc/nginx/fastcgi_params;
# fastcgi_pass unix:/var/run/php-fpm5.sock;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /srv/sites/shidenadvanced/www$fastcgi_script_name;
#}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Outside of that, I left most of the settings on my own. Not really sure what's going on. Can anyone shed some light?
source to share
Try it. I made a few changes to the way fastcgi is handled
server {
server_name www.shidenadvanced.com shidenadvanced.com;
access_log /srv/sites/shidenadvanced/logs/access.log;
error_log /srv/sites/shidenadvanced/logs/error.log;
root /srv/sites/shidenadvanced/www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
# use fastcgi for all php files
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
source to share
I personally prefer the socket solution:
fastcgi_pass unix:/path/tp/myfirst.socket;
instead
fastcgi_pass 127.0.0.1:9000;
but for host you also need fpm config:
[hak-rentrisch_de]
listen = /path/tp/myfirst.socket
listen.owner = hostuser
listen.group = hostgroup
listen.mode = 0666
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
user = hostuser
group = hostgroup
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 500
php_admin_value[include_path] = .:/var/www/libs
[...]
respectfully
source to share