0
在Nginx上安裝了HHVM。普通的PHP和HH文件工作正常。Silex在Nginx上運行HHVM
現在我要用Silex包裝網站。
安裝Silex的,現在換了Nginx的默認站點的conf此基礎上Silex的文檔: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;
}
}
現在根本行不通。 「/」和「/ code」訪問都給我一個502錯誤。
任何提示?
UPDATE
現在我改變了fastcgi_pass
從unix:/var/run/php-fpm/www.sock
到127.0.0.1:9000
,新問題。
- 訪問「/」即可。
- 訪問 「/ lib目錄」 是404
我的Silex這樣的代碼:
$app->get('/lib', function() use ($app)
{
$dir=__DIR__;
return $app['twig']->render('index.html.twig');
});
我試圖把一個.htaccess
根目錄,但沒有幫助。
月2日更新
我已經改變了我的Silex的代碼位:
$app->get('lib/', function() use ($app)
{
$dir=__DIR__;
dump($dir);die();
});
現在,如果我訪問了 「本地主機/ lib中/」,還是404,但是,「本地主機/ index.php文件/ lib「工作正常。
附上404頁面截圖。這看起來像Nginx的內部404?
這可以幫助你。 http://stackoverflow.com/a/16497957/1920638 – MrTechie 2015-04-06 04:08:04
謝謝。這解決了第一步問題。我會更新我的問題,因爲還有更多問題。 – TaylorR 2015-04-06 05:12:48
什麼是404,您的腳本或Web服務器? – 2015-04-06 05:21:42