nginx php-fpm empty site
- by Katafalkas
I am writing this as I was stuck trying to fix it whole night.
We have recently migrated to a new server. Before migration we have been running our site on nginx + cgi (script). After migration we decided to try apache + mod_php. It was rather terrible, and I would like to migrate back to nginx, but this time I want it with php-fpm (as people say its a cool)
So I did follow a number of guides and I think i done everything correctly.
As well as that I have our old config files for "server" section, which i reviewed and places into new config.
So I ended up having an empty site when I enter our URL. (By empty I mean blank page, no letter, errors or anything at all.) In the access log there are some weird errors like:
123.242.148.54 - - [22/Mar/2012:06:08:11 +0200] "-" 400 0 "-" "-"
My guess is that php-fpm is not working, but not sure how to confirm it.
Maybe some1 could give some help ? Would much appreciate.
my nginx config:
user nginx;
worker_processes 12;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types;
#default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
server {
listen 80;
server_name www.example.com;
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/error.log;
root /home/www/example;
index index.php;
client_max_body_size 50M;
#error_page 404 /404.html;
# phpMyAdmin
location /phpmyadmin {
root /usr/share/;
error_log /var/log/nginx/phpmyadmin.log;
try_files $uri $uri/ /index.php;
}
location ~ ^/phpmyadmin/.*\.php$ {
root /usr/share/;
error_log /var/log/nginx/phpmyadmin.log;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
# Munin
location /monitoring {
root /var/www/;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/monitoring_users;
error_log /var/log/nginx/monitoring.log;
index index.html;
}
# The site
location / {
try_files $uri $uri/ /index.php/?$uri&$args;
}
# PHP interpreter
location ~ \.php {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}