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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?