在 Amazon EC2 实例上安装 phpMyAdmin
Installing phpMyAdmin onto Amazon EC2 instance
我已将我的 EC2 实例配置为 LAMP,遵循 Amazon's tutorial。这似乎运行正常(我可以在我上传的文件中看到 phpinfo()
)。
然后我尝试通过执行以下操作来安装 phpMyAdmin:
sudo yum --enablerepo=epel install phpmyadmin
我可以看到 phpMyAdmin 现在在 /usr/share/phpmyadmin
中,所以我添加了一个符号 link:
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 地址已经改变,所以我被禁止了。
对接,我没有像查克建议的那样允许从所有 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>
而且有效~
我已将我的 EC2 实例配置为 LAMP,遵循 Amazon's tutorial。这似乎运行正常(我可以在我上传的文件中看到 phpinfo()
)。
然后我尝试通过执行以下操作来安装 phpMyAdmin:
sudo yum --enablerepo=epel install phpmyadmin
我可以看到 phpMyAdmin 现在在 /usr/share/phpmyadmin
中,所以我添加了一个符号 link:
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 地址已经改变,所以我被禁止了。 对接,我没有像查克建议的那样允许从所有 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>
而且有效~