How to change the www (DocumentRoot) folder to another partition in Apache 2.4 (Ubuntu 14.04)?

2

I tried to change the Document Root by changing the default.conf files in sites-available. However I get the message that I am not allowed to access localhost. Could anyone tell you the exact procedure? I may have forgotten something. - Apache 2.4.7 - Ubuntu 14.04

    
asked by anonymous 28.04.2014 / 02:15

2 answers

9

You need to change two apache configuration files:

File 1:

   sudo vim /etc/apache2/apache2.conf 

Change the line:

   <Directory /var/www/>

For        

It looks like this:

   <Directory /home/usuario/diretorio_que_vc_quiser/>
         Options Indexes FollowSymLinks
         AllowOverride All
         Require all granted
   </Directory>

File 2:

   $ sudo vim /etc/apache2/sites-available/000-default.conf
   ou
   $ sudo vim /etc/apache2/sites-available/default.conf

Change the line:

    DocumentRoot /var/www

for

    DocumentRoot /home/usuario/diretorio_que_vc_quiser/

Do not forget to restart apache after:

    $ sudo service apache2 restart
    
15.05.2014 / 14:05
0

I was having the same problem, I had forgotten about

<Directory /home/usuario/diretorio_que_vc_quiser/>

in the /etc/apache2/apache2.conf file

    
18.07.2014 / 15:17