Installed HHVM on Nginx. Plain PHP and HH files are working fine.
Now I am going to wrap the site with Silex.
Installed Silex and now changed the Nginx default site conf to this based on Silex documentation: http://silex.sensiolabs.org/doc/web_servers.html#nginx
server {
root /vagrant/hhvm;
#site root is redirected to the app boot script
location = / {
try_files @site @site;
}
#all other locations try other files first and go to our front controller if none of them exists
location / {
try_files $uri $uri/ @site;
}
#return 404 for all php files as we do have a front controller
location ~ \.php$ {
return 404;
}
location @site {
fastcgi_pass unix:/var/run/php-fpm/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
#uncomment when running via https
#fastcgi_param HTTPS on;
}
}
Now it simply won't work. "/" and "/code" visits all gives me a 502 error.
Any hints?
UPDATE
Now I changed the fastcgi_pass
from unix:/var/run/php-fpm/www.sock
to 127.0.0.1:9000
and new issues.
- Visiting "/" is OK.
- Visiting "/lib"is 404.
My Silex code like this:
$app->get('/lib', function() use ($app)
{
$dir=__DIR__;
return $app['twig']->render('index.html.twig');
});
I have tried to put an .htaccess
in the root directory but no help.
2nd UPDATE
I have changed my Silex code a bit:
$app->get('lib/', function() use ($app)
{
$dir=__DIR__;
dump($dir);die();
});
Now if I visited "localhost/lib/", still 404, but, "localhost/index.php/lib" is working fine.
The 404 page screen shot is attached. It seems like the Nginx internal 404?