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

Asked

Viewed 45,591 times

3

I tried to change the Document Root changing the files default.conf on sites-available. But I get the message that I’m not allowed to access the localhost. Would anyone know the exact procedure? May I have forgotten something. - Apache 2.4.7 - Ubuntu 14.04

  • 1

    In sites-enabled there is a link 000-default pointing to the file in question? How are the permissions of the new folder that should serve as root and its archive index.html (try to set 755)? Finally don’t forget to reset the server after modifying its settings (sudo service apache2 restart). More information about the procedures can be found at Ubuntu Documentation: HTTPD - Apache2 Web Server (in English)

2 answers

12


You need to change two apache configuration files:

File 1:

   sudo vim /etc/apache2/apache2.conf 

Change line:

   <Directory /var/www/>

To

Stay 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 line:

    DocumentRoot /var/www

for

    DocumentRoot /home/usuario/diretorio_que_vc_quiser/

Don’t forget to restart apache later:

    $ sudo service apache2 restart
  • 1

    Congratulations, very good I managed to solve the problem without difficulties and fast.

0

I had the same problem, I had forgotten

<Directory /home/usuario/diretorio_que_vc_quiser/>

in the file /etc/apache2/apache2.conf

Browser other questions tagged

You are not signed in. Login or sign up in order to post.