After a fresh install of Ubuntu, I am trying to change the localhost
directory of Apache2 (2.4.7). As always, it's not simple at all and it doesn't work right now.
Here's what I have done so far:
$sudo apt-get install apache2
Then in /etc/apache2/apache2.conf:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /home/louisro/Documents/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
in /etc/apache2/sites-enabled/000-default.conf:
#DocumentRoot /var/www/html
DocumentRoot /home/louisro/Documents/www
in /etc/apache2/sites-available/000-default.conf:
#DocumentRoot /var/www/html
DocumentRoot /home/louisro/Documents/www
Then
$ sudo chmod go+r /home/louisro/Documents/www
$ sudo chown -R louisro:www-data /home/louisro/Documents/www
When I try to access localhost throught the browser, I get:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80
And the log gives:
$ cat /var/log/apache2/error.log
[Fri Jan 22 09:13:38.792577 2016] [core:error] [pid 12934:tid 140432965080832] (13)Permission denied: [client ::1:56772] AH00035: access to / denied (filesystem path '/home/louisro/Documents') because search permissions are missing on a component of the path
Here's what solved the problem:
Try to change
apache2.conf
to:Command:
remove
.htaccess
if exist and createindex.txt
file then try to accesshttp://localhost/index.txt
You are missing one essential step. After modifying the default DocumentRoot in
000-default.conf
. To take effect you should enable000-default.conf
and restart apache2.I solved as:
First, I gave permission to the directory root. In my case this directory was:
/home/paulo/Documentos/SERVER
I run the following command:
After, I edited the file apache2.conf with the following command:
In the apache.conf I changed the following lines:
to
And I edited the file 000-default.conf in /etc/apache2/sites-available/000-default.conf and /etc/apache2/sites-enabled/000-default.conf. I changed the following lines:
Finally, I restarted the apache with the following command:
I really hope this run in your machine;