Апачи odd permission behavior in Ubuntu 14.04

Short версия:

Апачи deny access to file at/opt/adminer, but works эксперт expected if the file served is at/usr/share/adminer/adminer.

Longer версия:

The package adminer installs this индеец-апачи configuration file:

#Apache configuration

Alias /adminer /usr/share/adminer/adminer

<Directory /usr/share/adminer/adminer>
        Options FollowSymLinks
        DirectoryIndex index.php

        <IfModule mod_php5.c>
                AddType application/x-httpd-php .php

                php_flag magic_quotes_gpc Off
                php_flag track_vars On
                php_flag register_globals Off
                php_value include_path .
        </IfModule>
</Directory>

But the adminer версия provided in Ubuntu 14.04 is somewhat old, and I decided to download the current версия.

I удар в лунку the adminer.php (renamed to index.php) file at/opt/adminer, and changed the relevant paths in the previous configuration file accordingly.

Alias /adminer /opt/adminer
#Alias /adminer /usr/share/adminer/adminer

<Directory /opt/adminer>
#<Directory /usr/share/adminer/adminer>
        Options FollowSymLinks
        DirectoryIndex index.php

        <IfModule mod_php5.c>
                AddType application/x-httpd-php .php

                php_flag magic_quotes_gpc Off
                php_flag track_vars On
                php_flag register_globals Off
                php_value include_path .
        </IfModule>
</Directory>

But this don't work. When I использовал в browser to access the adminer Веб app, I see this:

Forbidden

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

In the log file:

[Thu Dec 10 18:08:15.425548 2015] [authz_core:debug] [pid 31647] mod_authz_core.c (802): [client 10.0.2.2:49992] AH01626: authorization result of Require all denied: denied

[Thu Dec 10 18:08:15.425671 2015] [authz_core:debug] [pid 31647] mod_authz_core.c (802): [client 10.0.2.2:49992] AH01626: authorization result of: denied

[Thu Dec 10 18:08:15.425691 2015] [authz_core:error] [pid 31647] [client 10.0.2.2:49992] AH01630: client denied by server configuration: / opt / adminer /

But if I copy the index.php file from/opt/adminer to/usr/share/adminer/adminer, and change the configuration file accordingly, it works flawlessly.

Обитайте info:

vagrant@vagrant-ubuntu-trusty-64:~$ ll /opt/adminer/
total 416
drwxr-xr-x 2 root root   4096 Dez  7 23:01 ./
drwxr-xr-x 3 root root   4096 Dez  7 22:10 ../
-rw-r--r-- 1 root root 415388 Nov 15 18:50 index.php

vagrant@vagrant-ubuntu-trusty-64:~$ ll /usr/share/adminer/adminer/
total 416
drwxr-xr-x 2 root root   4096 Dez 10 17:29 ./
drwxr-xr-x 3 root root   4096 Dez 10 17:29 ../
-rw-r--r-- 1 root root 415388 Dez 10 17:29 index.php
1
задан 10 December 2015 в 21:22

2 ответа

Я нашел проблему..

В/etc/apache2/apache2.conf:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
       Options Indexes FollowSymLinks
       AllowOverride None
       Require all granted
</Directory>

Так, Apache по умолчанию запрещает доступа ко всему кроме/usr/share и/var/www.

Таким образом, я должен отредактировать apache2.conf файл и также явно предоставить доступ к/, выберите:

<Directory /opt/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

или просто добавьте, Требуют всех предоставленных в части Каталога моего исходного конфигурационного файла:

Alias /adminer /opt/adminer
#Alias /adminer /usr/share/adminer/adminer

<Directory /opt/adminer>
#<Directory /usr/share/adminer/adminer>
        Options FollowSymLinks
        DirectoryIndex index.php
        Require all granted     # <----------

        <IfModule mod_php5.c>
                AddType application/x-httpd-php .php

                php_flag magic_quotes_gpc Off
                php_flag track_vars On
                php_flag register_globals Off
                php_value include_path .
        </IfModule>
</Directory>
1
ответ дан 7 December 2019 в 13:50

В сервере человечности 16.04.1 LTS необходимо добавить строку (/etc/apache2/apache2‌​ .conf):

#put some comment here to know what happend    
Include /etc/adminer/apache.conf

я добавил эту строку прежде:

<Directory />

и после перезапуска apache2 все хорошо работает.

, Прежде чем эта строка была добавлена, ничто не работало.

1
ответ дан 7 December 2019 в 13:50

Другие вопросы по тегам:

Похожие вопросы: