0

I am using Codenvy, the online IDE, and I need to amend the Apache config in order to edit the webroot.

Usually, this just consists of $ sudo vim /etc/apache2/sites-enabled/001-default.conf, but Codenvy doesn't seem to have any text editors available (vi, vim, nano, etc). I'm assuming this is by design.

So, my question: How can I amend the web root?

Mike
  • 8,767
  • 8
  • 49
  • 103

2 Answers2

0

You can install nano by

sudo apt-get install nano

and then probably you know how to change the web root by editing

sudo nano /etc/apache2/sites-available/your-site.conf
Tanay Karnik
  • 424
  • 6
  • 19
0

Document root is set to /projects because this is where Project Explorer is looking for projects sources in a workspace. You may want to take a look at this Dockerfile: https://github.com/codenvy/dockerfiles/blob/master/php/latest/Dockerfile#L30

You can certainly set web root for any other directory, but create a symlink to /projects directory to find your sources in the Project Explorer and be able to open files in the editor.

You can set it using mcedit in a running workspace, however, when a workspace is stopped, these changes are gone. So you'll need to snapshot you workspace to save changes.

Or you can set it with sed in the Dockerfile when creating a workspace on the Dashboard > Custom Stack > Write your own stack. It may look something like this:

FROM codenvy/php
RUN sudo sed -i 's/\/var\/www\/html/\/projects/g'  /etc/apache2/sites-available/000-default.conf