0

I deployed an application on Heroku and I used a folder to place all my files inside thus now my application is only accesible from:

http://myapp.heroku.com/app/

Is it possible to create a virtual root to point

http://myapp.heroku.com -> http://myapp.heroku.com/app/ ?

Something similar to Apache VirtualHost?:

<VirtualHost 10.1.2.3>
  ServerAdmin webmaster@host.foo.com
  DocumentRoot /www/docs/host.foo.com
  ServerName host.foo.com
  ErrorLog logs/host.foo.com-error_log
  TransferLog logs/host.foo.com-access_log
</VirtualHost>

Thanks in advance.

glarkou
  • 7,023
  • 12
  • 68
  • 118

2 Answers2

2

Yes you can configure the apache as well, however, this needs some changes on your system.

I've compiled a blog post recently that shows this (as the last part), it also shows how you can compile your own PHP extensions for heroku:

PHP on Heroku, again (by hakre; 20 May 2012)

It basically works by extending the standard configuration with your additional settings in another file. Look for the Configure the Webroot section, that's where it starts:

Now comes the next tricky part that is specifying the webroot. Specifying the webroot needs a little bit more work and background information. The CVBacklogs applications webroot in the git-tree is src/app/public. For Heroku, by default, the webroot is the root of the git-tree. That directory is internally mapped to /app/www btw. So what this needs is to create a so called Procfile that starts a sh-script each time the Heroku app web-node starts. That script then modifies the Apache configuration and includes your own config which is setting the webroot to /app/www/src/app/public. So we create the procfile, a config directory, the script and the Apache configuration. Ready?

hakre
  • 193,403
  • 52
  • 435
  • 836
0

You can't do anything with Apache / Nginx configuration on Heroku - these are all beyond your control. You could do some kind of php based redirect in the root folder to the /app folder or alternatively rejig the repo so app is the top level.

John Beynon
  • 37,398
  • 8
  • 88
  • 97
  • Wrong, the cedar stack allows changing apache settings, see [my answer](http://stackoverflow.com/a/10865955/367456) – hakre Jun 02 '12 at 21:09
  • In case such is not possible (e.g. older/other platform/stack), it's possible to fake this with `.htaccess` and if `mod_rewrite` is available. Part of that is to mask `.htaccess` files as 404, you find a related question here: [Requests to .htaccess should return 404 instead of 403](http://stackoverflow.com/q/7945795/367456) the other part I was not able to find quickly. – hakre Jun 03 '12 at 08:09