Reputation: 4546
I have working on an Ubuntu 13.04 x64 server and I have successfully installed NGINX and PHP-FPM and made sure that they were working as well. However after modifying the config file for the configuration to match that of Yii, I am getting a blank page.
This is my NGINX config file :
#config file
server {
listen 80;
set $host_path "/usr/share/nginx/html/something";
server_name something.com;
root /usr/share/nginx/html/something;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
This is the original config file that works :
server {
listen 80;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name campusplugin.com;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
I have just changed the root directory as I have kept the files in the respective directories as specified in the root.
However, whenever I try to access the site, I get a blank page with nothing in it. I have no idea where I am going wrong. I am very new to NGINX.
Please help me.
Upvotes: 2
Views: 2009
Reputation: 3182
Sometimes when you using Nginx with php-fpm php errors are not displaying and as result Nginx return empty page.
1) If you want to see this "hidden" errors, try setup error log for nginx, add below server_name:
error_log /path/to/your/error-log/fpm-error.log;
Upvotes: 1