Php 404在zend framwork-Nginx-ubuntu 14.04中使用控制器时

Php 404在zend framwork-Nginx-ubuntu 14.04中使用控制器时,php,linux,ubuntu,zend-framework,nginx,Php,Linux,Ubuntu,Zend Framework,Nginx,我正在使用Ubuntu14.04并安装了Nginx、php5和Zend framework 1.12,我需要在我工作的项目中使用这三个。 当我尝试访问索引(localhost)时,它会立即加载,但当我尝试访问像localhost/Guestbook这样的控制器(从其页面的指南中)时,我得到一个404错误。 我尝试过使用不同的控制器和不同的项目,都是一样的,主页加载很好,但我无法访问任何控制器 这就是我配置Nginx的方式 server { listen 80 default_server; li

我正在使用Ubuntu14.04并安装了Nginx、php5和Zend framework 1.12,我需要在我工作的项目中使用这三个。 当我尝试访问索引(localhost)时,它会立即加载,但当我尝试访问像localhost/Guestbook这样的控制器(从其页面的指南中)时,我得到一个404错误。 我尝试过使用不同的控制器和不同的项目,都是一样的,主页加载很好,但我无法访问任何控制器

这就是我配置Nginx的方式

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /var/www/qstart/public;
index index.php index.htm;

server_name test-php;

location / {        
    try_files $uri $uri/ =404;      
}


#error_page 404 /404.php;

# redirect server error pages to the static page /50x.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_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;       
    fastcgi_index /index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
    deny all;
}
}

假设您的框架入口点是
/index.php
,您需要通过该脚本路由大多数URI。通常的技术是将其作为默认操作(而不是您当前实现的404返回代码)

尝试将默认位置块更改为:

location / {
    try_files $uri $uri/ /index.php;
}

假设您的框架入口点是
/index.php
,您需要通过该脚本路由大多数URI。通常的技术是将其作为默认操作(而不是您当前实现的404返回代码)

尝试将默认位置块更改为:

location / {
    try_files $uri $uri/ /index.php;
}