V
V
Valter Funk2014-02-05 19:02:39
Apache HTTP Server
Valter Funk, 2014-02-05 19:02:39

Why is Apache2 giving Forbidden 403?

It costs ubuntu 13.10, installed apache, installed mod_macro to quickly add hosts.
Here is the macro code:

<Macro VHost $host $path> 
    <VirtualHost *:80> 
        DocumentRoot "$path" 
        ServerAdmin [email protected] 
        ServerName $host 
        ServerAlias www.$host 

        DirectoryIndex index.php index.html index.htm index.shtml 

        <Directory "$path"> 
        Options FollowSymLinks 
        	Options all 
                AllowOverride All 
    allow from all
        </Directory> 
    </VirtualHost> 
</Macro>
Use VHost blog.loc /home/www-data/www/blog

When I try to open blog.loc I get:
Forbidden

You don't have permission to access / on this server.

Apache/2.4.6 (Ubuntu) Server at blog.loc Port 80

First of all, I set the rights to the folder:
sudo chmod -R 777 /home/www-data/www/blog
It did not help.
The next step is to set the rights to 777 on all higher folders
sudo chmod -R 777 /home
. What is typical, if you change it
Use VHost blog.loc /home/www-data/www/blog
to
Use VHost blog.loc /var/www/blog
(created a blog folder in /var/www for verification), it starts up normally
Tell me what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Merlyel, 2014-02-05
@ValterFS

First, check the error.log, and then try to log in under the user from which apache is running
and try to go to the desired folder under it.
cd /home/www-data/www/blog

E
ehabrahabr, 2014-06-30
@ehabrahabr

Require all granted

<VirtualHost *:80>
  ServerName   site

  ...

  <Directory /home/www/site/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    Require all granted

  </Directory>

  ...

</VirtualHost>

T
Timur Yessentayev, 2015-10-10
@Timures

ctrl+alt+t
sudo gedit /etc/apache2/apache2.conf 

+ add 
<Directory /home/your_user/folder_public_html> 
 Options Indexes FollowSymLinks 
 AllowOverride None 
 Require all granted
</Directory> 

+ sudo service apache2 restart

Мне помогло)

V
vgroups, 2020-05-31
@vgroups

2020.g
Maybe someone else will come in handy
Go to /etc/apache2
Open apache2.conf
line 170 and replace line 174 with this
Directory /var/www/>
AllowOverride All
Restart Apache service apache2 restart or service httpd restart

M
Merlyel, 2014-02-05
@Merlyel

Is there an index file in the folder at all?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question