0

I am trying to change the DocumentRoot on Apache in Ubuntu. I want that the main folder will be a directory with the path /var/something instead of /var/www.

I tried it going to the directory /etc/apache2/sites-available and modifying the property DocumentRoot from the file 000-default.conf from DocumentRoot /var/www to DocumentRoot /var/something but nothing changed. I still see the file that I have as default for the directory /var/www.

I also tried doing the same with the 000-default.conf file on the directory /etc/apache2/sites-enabled and also modifying both at the same time but the result it is the same.

Am I modifying the wrong file or the wrong property?

Thanks in advance!

Francisco Romero
  • 11,900
  • 18
  • 71
  • 151
  • if you put a symlink in `/var/www` that points to `/var/something` you can put your files in `/var/something` and it will serve them as long as `FollowSymlinks` is set in `httpd.conf`. Not sure if this is what you're looking for though – Jordan Camp Feb 06 '16 at 05:29
  • @JordanCamp I need to change my default directory. That when I put `localhost:80` the content of the directory `/var/extras` will be displayed. – Francisco Romero Feb 06 '16 at 11:25
  • I thing your question might be the same as this [one](http://stackoverflow.com/questions/5891802/how-do-i-change-the-root-directory-of-an-apache-server) – Jordan Camp Feb 06 '16 at 17:30

1 Answers1

0

Finally, I found the solution to my question on the file apache2.conf in /etc/apache2 directory.

I just had to add this line (it does not appear on the file):

DocumentRoot /var/something

After that I had to restart apache:

/etc/init.d/apache2 restart

and now when I try to access to localhost:80 it shows me the file that it is as default on that folder.

Francisco Romero
  • 11,900
  • 18
  • 71
  • 151