我不明白为什么mvc路线不起作用。
当我访问主页时,所有的css和js都已加载。
"GET /css/main.css HTTP/1.1" 304
但当我访问任何其他控制器时,我得到了:
method=GET path="/transaction/add"
[error] open() "/app/public/transaction/add" failed (2: No such file or directory)
"GET /transaction/add HTTP/1.1" 404
这是我的procfile
--Procfile--
web: vendor/bin/heroku-php-nginx public/
location / {
# try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}
location @rewriteapp {
# rewrite all to app.php
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
try_files @heroku-fcgi @heroku-fcgi;
internal;
}
我真的迷失在这里。
答案 0 :(得分:1)
这应该有效:
location / {
# try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}
location @rewriteapp {
# rewrite all to app.php
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/index\.php(/|$) {
try_files @heroku-fcgi @heroku-fcgi;
internal;
}
答案 1 :(得分:0)
请尝试按照文档中的说明进行操作:http://docs.phalconphp.com/fr/latest/reference/nginx.html
server {
listen 80;
server_name localhost.dev;
index index.php index.html index.htm;
set $root_path '/var/www/phalcon/public';
root $root_path;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index /index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}