L
L
lllyx2019-01-08 19:31:39
PHP
lllyx, 2019-01-08 19:31:39

Why is phpmyadmin on a separate domain throwing a 403 error?

phpMyAdmin.conf
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
      #Require ip 127.0.0.1
      #Require ip ::1
        Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     #Allow from 127.0.0.1
     #Allow from ::1
        Require all granted
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       #Require ip 127.0.0.1
       #Require ip ::1
        Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     #Allow from 127.0.0.1
     #Allow from ::1
        Require all granted
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>


<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>
#</IfModule>


mysql.lllyx.ru.conf
<VirtualHost *:80>
    ServerName www.mysql.lllyx.ru
    ServerAlias mysql.lllyx.ru
    DocumentRoot /usr/share/phpmyadmin
    <Directory /usr/share/phpmyadmin>
        Options FollowSymLinks
        DirectoryIndex index.php
    </Directory>
<IfModule php7_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
        DirectoryIndex index.html index.php
    </IfModule>
</IfModule>


    # Authorize for setup
    <Directory /usr/share/phpmyadmin/setup>
            <IfModule mod_authn_file.c>
            AuthType Basic
            AuthName "phpMyAdmin Setup"
            AuthUserFile /etc/phpmyadmin/htpasswd.setup
            </IfModule>
            Require valid-user
    </Directory>

    # Disallow web access to directories that don't need it
    <Directory /usr/share/phpmyadmin/libraries>
            Order Deny,Allow
            Deny from All
    </Directory>

    <Directory /usr/share/phpmyadmin/setup/lib>
            Order Deny,Allow
            Deny from All
    </Directory>
</VirtualHost>

I wanted to bring phpmyAdmin to a separate domain, it worked, but an error 403 began to appear
How to solve? Apache server, php version 7.1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lllyx, 2019-02-26
@lllyx

To answer my own question, you need to move the phpMyAdmin folder to www/your_domain/
and set up .conf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question