[英]404 when using a controller in zend framwork - Nginx - ubuntu 14.04
我正在使用ubuntu 14.04并安装了Nginx,php5和Zend框架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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.