Answer the question
In order to leave comments, you need to log in
Why can't Apache access the directory?
Good afternoon.
I have a directory that contains images.
/
-images/
--01/
--- 1.png
-previews/
--01/
--- 2.png
-icons/
--titles/
---3.png
The virtual host points to this directory:
<VirtualHost *:80>
ServerName storage.site.loc
DocumentRoot /var/site/storage
<Directory /var/site/storage/>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
drwxrwxrwx 8 haru haru 4096 Jan 2 14:05 .
drwxrwxrwx 7 root root 4096 Jan 2 11:41 ..
drwxrwxrwx 2 haru haru 4096 Jan 2 14:05 icons
drwxrwxrwx 144 haru haru 4096 Jan 1 16:13 images
http://storage.site.loc/icons/titles/3.png
The problem is this: apache gives a 404 code
when accessing the address . At the same time, files from the images and previews directories are returned normally. Answer the question
In order to leave comments, you need to log in
I found out what was the problem.
There /etc/apache2/mods-enabled/alias.conf
was a line in the file Alias /icons/ "/usr/share/apache2/icons/"
. I commented it out and it worked.
Previously, the storage directory was not the root directory and links to it looked like site.com/storage/icons/1.png. Because of this, apparently, the alias did not work.
Now I'm scratching my head: where did this alias come from and why was it needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question