dt3999 2015-10-15 23:16
浏览 41
已采纳

Yii2应用程序不在Heroku域上显示

I installed a Yii2 "basic" app on a Cloud9 workspace using composer. It runs fine as you can see here https://portfolio-php--dfmmalaw.c9.io/basic/web/index.php

Problem is I am getting below error when trying to view after deploying to Heroku URL.

"Forbidden You don't have permission to access / on this server."

The below screenshot is my Cloud9 workspace http://prntscr.com/8rrkn0

I even tried adding basic/web/index.php to the Heroku URL but I just get a blank page. What am I doing wrong?

  • 写回答

2条回答 默认 最新

  • douji9734 2015-10-20 18:33
    关注

    After getting help from Herokai, David Zuelke, I decided to create a how-to on the subject of "Creating Yii2 App in Cloud9 → Pushing to Github → Deploying to Heroku". Please see below (google doc link at top if easier to read):

    https://docs.google.com/document/d/15teHaGWUWSNW_VwdV3-7bVpQHNRv2G0Z8GPFbIB-ogs/edit

    1) Create Yii2 “basic” app:

    290795 $ composer create-project --prefer-dist yiisoft/yii2-app-basic basic
    

    2) Move into “basic” directory

    290795 $ cd basic/
    

    3) Initialize local repo for “basic” directory

    basic $ git init
    

    4) Add and commit Yii project

    basic $ git add .
    basic $ git commit -m "basic Yii project"
    

    5) Add procfile that will point to index.php (entry script) in “web” directory

    basic $ echo "web: vendor/bin/heroku-php-apache2 web/" > Procfile
    basic $ git add Procfile 
    basic $ git commit -m "Procfile for Heroku"
    

    6) Comment out debugging stuff (I do this manually instead of from command line)

    basic $ vim web/index.php # remove dev/debug env stuff (not my way)
    basic $ git add web/index.php 
    basic $ git commit -m "remove dev/debug env"
    

    7) This updates the dependency from v1.0.3 to v1.1 (absolute necessity)

    basic $ composer require fxp/composer-asset-plugin
    basic $ git add composer.json composer.lock 
    basic $ git commit -m "use fxp/composer-asset-plugin in project"
    

    8) Create Heroku app and push to it. (I instead create and push to Github repo)

    basic $ heroku create
    basic $ git push heroku master (again I push to Github Repo synced with Heroku)
    

    9) Add logging to Heroku for Yii app (no logging for Yii out of the box)

    basic $ echo "web: vendor/bin/heroku-php-apache2 -l runtime/logs/app.log web/" > Procfile
    basic $ git add Procfile 
    basic $ git commit -m "tail runtime/logs/app.log"
    basic $ git push heroku master (again I push to Github Repo synced with Heroku)
    

    10) This allows the “Contact” page to work (not sure why)

    basic $ composer require ext-gd:* --ignore-platform-reqs
    basic $ git add composer.json composer.lock 
    basic $ git commit -m "require GD for contact CAPTCHA"
    basic $ git push heroku master (again I push to Github Repo synced with Heroku)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛