2
이 코드는 heroku의 예제에서 나온 것입니다. 그러나 경로 /를 제외하고 내가 추가 한 다른 것은 작동하지 않습니다. 이 제품은 404 :"/"를 제외한 Heroku silex 루트 쇼 404
을 보여줍니다. 요청하신 URL/e은이 서버에서 발견되지 않았습니다. (각 지점을 마스터 추진에 Heroku가 자동 빌드)
$app->match('/', function(Symfony\Component\HttpFoundation\Request $request) use ($app) {
return $app['twig']->render('index.twig');
});
$app->match("/dump", function(Symfony\Component\HttpFoundation\Request $request) use ($app) {
return new Response('Thank you for your feedback!', 201);
})->bind("dump");
$app->get("/t", function() use ($app) {
return new Response('Thank you for your feedback!', 201);
})->bind("t");
$app->get("/d", function() {
return new Response('Thank you for your feedback!', 201);
})->bind("d");
$app->get("/e", function() {
return new Response('Thank you for your feedback!', 201);
});
$app->run();
편집 한 내가 직접 Heroku가 서버에 배포
편집 2 내 작업 공간 :
bin\worker.php
www\index.php <== the snippet is from this file
www\list.php
apache_app.conf
app.php <== basic init, return Silex\Application $app
Procfile
apache_app.conf
의 내용은에서 복사됩니다. 210. 한다 RewriteEngine는
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app.php [L]
에 나는 어떻게 든 아파치 설정을 변경해야한다고 생각하지만, 나는 htaccess로 구문을 이해하지 않습니다. 내용으로의 nginx의 conf 파일을 생성, nginx를 들어
web: vendor/bin/heroku-php-apache2 web/
:
은'/ index.php/e'가 작동합니까? 웹 서버를 구성 했습니까? 당신은 아파치 또는 nginx를 사용하고 있습니까? – Federkun
@Federkun 아니, 아무도 작동하지 않습니다. 내가 heroku 서버에 배포 한 이래로 나는 그것으로 설정을 할 수 있다고 생각하지 않는다. 그리고 내가 아는 한, 그들은 apache2를 사용하고 있습니다. – Ngoc
http://silex.sensiolabs.org/doc/2.0/web_servers.html#apache를 참조하십시오. '/ index.php/e' ('/ index.php'는 프론트 컨트롤러입니다)가 작동해야합니다. '/ index.php'로 갈 때, 인덱스 페이지를 올바르게 반환하고 있습니까? – Federkun