我已将我的 EC2 实例配置为 LAMP,遵循 Amazon's tutorial .这似乎运行正常(我可以在我已上传的文件中看到 phpinfo()
)。
然后我尝试通过执行以下操作来安装 phpMyAdmin:
sudo yum --enablerepo=epel install phpmyadmin
我可以看到 phpMyAdmin 现在在 /usr/share/phpmyadmin
中,所以我添加了一个符号链接(symbolic 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 禁止响应:您无权访问此服务器上的/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
现在可以使用了!
关于mysql - 在 Amazon EC2 实例上安装 phpMyAdmin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28324837/