我能夠從Github回購庫成功將我的Yii2應用程序部署到Heroku。然而,當我嘗試訪問Heroku提供的域名時(https://portfolio-php.herokuapp.com),我收到一條錯誤消息:「禁止您無權訪問/在此服務器上。」我的構建日誌在下面提供。有人可以提供任何指導嗎?在成功部署後無法在Heroku上查看Yii應用程序
-----> PHP app detected
-----> Resolved 'composer.lock' requirement for PHP to version 5.6.14.
-----> Installing system packages...
- PHP 5.6.14
- Apache 2.4.17
- Nginx 1.8.0
-----> Installing PHP extensions...
- mbstring (composer.lock; bundled)
- zend-opcache (automatic; bundled)
-----> Installing dependencies...
NOTICE: Using '/composer.phar' to install dependencies.
Composer version 1.0-dev (9e67bc761be98b45875855003eb8b2f23f4bf5a5) 2015-09-18 14:32:06
Loading composer repositories with package information
Installing dependencies from lock file
- Installing yiisoft/yii2-composer (2.0.3)
Loading from cache
- Installing bower-asset/jquery (2.1.4)
Loading from cache
- Installing bower-asset/jquery.inputmask (3.1.63)
Loading from cache
- Installing bower-asset/punycode (v1.3.2)
Loading from cache
- Installing bower-asset/yii2-pjax (v2.0.4)
Loading from cache
- Installing cebe/markdown (1.1.0)
Loading from cache
- Installing ezyang/htmlpurifier (v4.6.0)
Loading from cache
- Installing yiisoft/yii2 (2.0.6)
Loading from cache
- Installing bower-asset/bootstrap (v3.3.5)
Loading from cache
- Installing yiisoft/yii2-bootstrap (2.0.4)
Loading from cache
- Installing swiftmailer/swiftmailer (v5.4.1)
Loading from cache
- Installing yiisoft/yii2-swiftmailer (2.0.4)
Loading from cache
Generating optimized autoload files
-----> Preparing runtime environment...
NOTICE: No Procfile, using 'web: vendor/bin/heroku-php-apache2'.
-----> Discovering process types
Procfile declares types -> web
-----> Compressing... done, 80.9MB
-----> Launching... done, v12
https://portfolio-php.herokuapp.com/ deployed to Heroku
我正在使用基本的Yii2模板。沒有htaccess文件和配置文件讀取:
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'gfWIx3XdsOCYeUve6VVm1KF4VayT0z7t',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => require(__DIR__ . '/db.php'),
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}
return $config;
您使用基本或高級模板?你在你的htaccess文件有哪些?和配置文件?求你了,發佈更多信息。 –
非常感謝你的快速回復。我正在使用基本模板,我不相信有一個.htaccess文件。配置文件如下: –
只是添加了更多信息到原始文章,包括配置文件內容 –