我在 Ubuntu 13.04 x64 服务器上工作,我已经成功安装了 NGINX 和 PHP-FPM,并确保它们也能正常工作。然而,在修改配置文件以匹配 Yii 的配置文件后,我得到一个空白页。
这是我的 NGINX 配置文件:
#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;
}
}
这是有效的原始配置文件:
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;
}
}
我刚刚更改了根目录,因为我将文件保存在根目录中指定的相应目录中。
但是,每当我尝试访问该站点时,都会得到一个空白页面,其中没有任何内容。我不知道我哪里出错了。我对 NGINX 很陌生。
请帮我。