簡體   English   中英

在Zend Framwork中使用控制器時出現404-Nginx-Ubuntu 14.04

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM