繁体   English   中英

将phpMyAdmin安装到Amazon EC2实例上

[英]Installing phpMyAdmin onto Amazon EC2 instance

我按照亚马逊的教程将我的EC2实例配置为LAMP。 这看起来运行正常(我可以在我上传的文件中看到phpinfo() OK)。

然后我尝试通过执行以下操作来安装phpMyAdmin:

sudo yum --enablerepo=epel install phpmyadmin

我可以看到phpMyAdmin现在在/usr/share/phpmyadmin ,所以我添加了一个符号链接:

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

然后我编辑了http.conf以将AllowOverride all添加到<Directory "/var/www/html"> (命令: sudo nano /etc/httpd/conf/httpd.conf

然后重新启动服务器:

sudo service httpd restart

但每当我访问http://ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com/phpmyadmin我都会从服务器收到403 Forbidden响应: 您无权访问/ phpmyadmin在这台服务器上。

我觉得我错过了一些非常明显的东西,但我无法弄清楚是什么。

我需要更新/etc/httpd/conf.d/phpMyAdmin.conf以允许远程用户。

我只是替换了第一个<directory>标签的内容,如此...

我删除了:

<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
  </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/>
 AddDefaultCharset UTF-8

 Order allow,deny
 Allow from all
</Directory>

并重新启动服务器: sudo service httpd restart

现在就行!

我有同样的问题,而Chuck Le Butt的解决方案非常有帮助,虽然对我来说有点不同......

我的ISP使用动态IP地址,因此当我设置服务器时,它是通过不同的IP。 当我第二天回到它时,我的IP地址已经改变,所以我被禁止了。 但是,我没有像Chuck建议的那样允许所有IP访问,而是在phpMyAdmin.conf文件中更新了我以前的IP地址。

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

我替换

<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
    </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/>
  Order Deny,Allow
  Deny from All
  Allow from 127.0.0.1
  Allow from ::1
</Directory>

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

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAll>
       Require all granted
     </RequireAll>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Allow,Deny
     Allow from All
   </IfModule>
</Directory>

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

它有效〜

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM