Max2019-01-10 00:25:34
Apache HTTP Server
Max, 2019-01-10 00:25:34

Apache 403 with Alias ​​from external folder, how to fix?

Prompt with Apache.

AliasMatch "^/wp-content/uploads/2019/../(..)(.*)$" "/mnt/hdd/dbimg/$1/$1$2"

when requesting an image at

image should be taken from here

It seems that everything is correct with the regular expression, don't let 2019/01 confuse you (there can be any number instead of 01), and the folder with the final file is called by the first 2 characters of the file name.
Gives 403 error.
Read here ( https://stackoverflow.com/questions/11215283/alias...) and here ( httpd.apache.org/docs/2.4/upgrading.html ) added:
<Location "/mnt/hdd/dbimg/00">
    SetHandler dbimg
    Require all granted

But it still doesn't work, maybe there's a bug here. Tried different variations...
<Directory "/mnt/hdd/dbimg/00">
    Require all granted

The /dbimg folder itself and everything below have the rights for admin (directoryroot user).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Max, 2019-01-10

Found the keyphrase here https://stackoverflow.com/a/13355590/2103823
I had root rights on /mnt, created a test directory /tmp2 and gave it admin rights, everything worked.
Are there other ways, without changing permissions for /mnt (this is the directory where hdds are mounted) to complete the task?

Stalker_RED, 2019-01-10

<Location "/mnt/hdd/dbimg/00">...
Read about what document_root is and about relative paths. Why do you need to expose your entire file system to the Internet?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question