2014-05-16 8 views
25

Ich brauche die Datei /etc/httpd/conf.d/phpMyAdmin.conf zu modifizieren, um Remote-Benutzer (nicht nur localhost) zu erlauben, um sich einzuloggenphpMyAdmin ermöglichen Remote-Benutzer

# 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/> 
    <IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     Require ip 127.0.0.1 
     Require ip ::1 
    </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 
    </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 
    </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 
    </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> 
+1

Möchten Sie es offen für alle oder nur bestimmte IP-Adressen? –

+0

Ich möchte es für alle öffnen –

+0

Haben Sie das jemals zur Arbeit gebracht? –

Antwort

4

Ersetzen Sie den Inhalt des ersten <directory>-Tag.

Entfernen:

<Directory /usr/share/phpMyAdmin/> 
<IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
    Require ip 127.0.0.1 
    Require ip ::1 
    </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 
</IfModule> 
</Directory> 

Und legen Sie stattdessen:

<Directory /usr/share/phpMyAdmin/> 
Order allow,deny 
Allow from all 
</Directory> 

Vergessen Sie nicht, Apache danach neu zu starten.

+0

mag 16 23:33:29 localhost.localdomain httpd [2212]: httpd: Syntaxfehler in Zeile 353 von /etc/httpd/conf/httpd.conf : Syntaxfehler in Zeile 11 von /etc/httpd/conf.d/phpMyAdmin.conf:/etc/httpd mag 16 23:33:29 localhost.localdomain systemd [1]: httpd.service: Hauptprozess beendet, Code = exited, status = 1/FAILURE mag 16 23:33:29 localhost.localdomain systemd [1]: Der Apache HTTP Server konnte nicht gestartet werden. - Betreff: Unit httpd.service ist fehlgeschlagen - Defined-By: systemd - Unterstützung: http://lists.freedesktop.org/mailman/listinfo/systemd-devel –

+0

Hoppla, ich hatte einen Tippfehler. Überprüfen Sie meine bearbeitete Antwort. –

+0

Im Browser erhalte ich: 'Verboten: Sie haben keine Zugriffsrechte auf/phpmyadmin auf diesem Server. ' –

1

Versuchen Sie, diese

ersetzen

<Directory /usr/share/phpMyAdmin/> 
    <IfModule mod_authz_core.c> 
     # Apache 2.4 
     <RequireAny> 
      Require ip 127.0.0.1 
      Require ip ::1 
     </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 
    </IfModule> 
</Directory> 

mit diesem:

<Directory "/usr/share/phpMyAdmin/"> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride all 
     Order Allow,Deny 
    Allow from all 
</Directory> 

die folgende Zeile hinzufügen für einen leichten Zugang:

Alias /phpmyadmin /usr/share/phpMyAdmin 
+1

Im Browser erhalte ich:' Verboten: Sie sind nicht berechtigt Zugriff/phpmyadmin auf diesem Server. –

+0

Ich füge meinem vorherigen Kommentar eine Notiz, da es nicht möglich ist, es zu bearbeiten. Ich wurde weder zur Eingabe des Benutzers noch des Passworts aufgefordert, bevor die Meldung "Verboten: Sie haben keine Zugriffsberechtigung für/phpmyadmin auf diesem Server" erhalten. Fehlermeldung –

+0

Es sollte zur Eingabe von Benutzername und Passwort mit einem phpMyAdmin Login-Bildschirm auffordern. Hast du versucht Apache neu zu starten? –

19

Verwendung dieser, habe es behoben für mich, über CentOS 7

<Directory /usr/share/phpMyAdmin/> 
Options Indexes FollowSymLinks MultiViews 
AllowOverride all 
Require all granted 
</Directory> 
+1

Funktioniert auf meinem Amazon Linux –

71

Die anderen Antworten scheinen bisher der komplette Austausch des < Verzeichnis/> Block einzutreten, ist dies nicht erforderlich ist, und entfernen Sie können zusätzliche Einstellungen wie die ‚AddDefaultCharset UTF-8‘ jetzt enthalten.

Remote-Zugriff zu ermöglichen, benötigen Sie 1 Zeile auf 2,4 Konfigurationsblock hinzuzufügen, oder 2 Zeilen zu ändern, in den 2.2 (abhängig von Ihrer Apache-Version):

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

    <IfModule mod_authz_core.c> 
    # Apache 2.4 
    <RequireAny> 
     #ADD following line: 
     Require all granted 
     Require ip 127.0.0.1 
     Require ip ::1 
    </RequireAny> 
    </IfModule> 
    <IfModule !mod_authz_core.c> 
    # Apache 2.2 
    #CHANGE following 2 lines: 
    Order Allow,Deny 
    Allow from All 
    Allow from 127.0.0.1 
    Allow from ::1 
    </IfModule> 
</Directory> 
+3

Ich kann bestätigen, dass dies mit Centos 7 funktioniert. Danke. –

+1

Funktioniert mit EC2-Instanzen. – driftking9987

+0

Es funktioniert auf CentOS 7.2 x64. Vielen Dank. –

0

einfach alle Linien in dem ersten Verzeichnis kommentieren. Oder Sie können diese Zeilen entfernen, aber besser, wenn Sie später einige Einschränkungen hinzufügen möchten, werden Sie die Kommentarzeichen entfernen.

#<Directory /usr/share/phpMyAdmin/> 
# <IfModule mod_authz_core.c> 
#  # Apache 2.4 
#  <RequireAny> 
#  Require ip 127.0.0.1 
#  Require ip ::1 
#  </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 
# </IfModule> 
#</Directory> 
0

Mein Setup war ein wenig anders mit XAMPP. in httpd-xampp.conf musste ich folgende Änderung vornehmen.

Alias /phpmyadmin "C:/xampp/phpMyAdmin/" 
<Directory "C:/xampp/phpMyAdmin"> 
    AllowOverride AuthConfig 
    Require local 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</Directory> 

Änderung

Alias /phpmyadmin "C:/xampp/phpMyAdmin/" 
<Directory "C:/xampp/phpMyAdmin"> 
    AllowOverride AuthConfig 
    #makes it so I can config the database from anywhere 
    Require all grant 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</Directory> 

muss ich feststellen, dass ich auf diese neue Marke bin so bin ich nur um Hacking, aber das ist, wie ich habe es funktioniert.

0

Meine Antwort basiert auf dem Erhalten eines 403-Fehlers, obwohl ich alle Apache-Einstellungen, die in den anderen Antworten erwähnt wurden, korrekt hatte.

Es war ein frischer Centos 7 Server und es stellte sich heraus, dass das Problem nicht die Apache-Einstellungen waren, sondern die Tatsache, dass der PhpMyAdmin überhaupt nicht funktionierte. Die Lösung war, PHP zu installieren und die PHP-Direktive zu Apache hinzuzufügen.conf:

  • sudo yum install php php-mysql
  • vim /etc/httpd/conf/httpd.conf fügen etwas wie
  • DirectoryIndex- index.php index.phtml index.html index.htm zu dienen pHP-Index-Dateien auch und starten Sie Apache

vergessen Sie nicht, neu zu starten Apache-Server wirksam - systemctl Neustart httpd.service

Ich hoffe, das hilft. Ich dachte zuerst, dass mein Problem Apache-Anweisungen wären, also poste ich meine Lösung hier.