[英]Amazon AWS server with database on localhost, how do I ssh so that my php webservices on localhost can run on it?
Server newbie here! 服务器新手在这里!
I have access to an amazon AWS server, and I have a php webservice on my localhost. 我可以访问亚马逊AWS服务器,我的localhost上有一个php webservice。 The php is working properly on the webservice.
php在webservice上正常工作。 The MySQL is set up on the server.
MySQL已在服务器上设置。 However, I cannot connect to my server.
但是,我无法连接到我的服务器。 I set up everything on the amazon AWS server by SSH-ing in to it and working from there.
我在亚马逊AWS服务器上设置了所有内容,通过SSH连接到它并在那里工作。 Is there a way to allow me to ssh into the server with my webservice?
有没有办法让我用我的webservice ssh到服务器?
Just to reiterate: -My php script is at localhost/ ... -My server is accessed by ssh and then on my localhost, it is hosted by amazon aws (default port 3306) 只是重申: - 我的php脚本是在localhost / ... - 我的服务器是由ssh访问然后在我的localhost上,它由amazon aws(默认端口3306)托管
I attempted the process suggested by one user which was to enter the following into my terminal: 我尝试了一个用户建议的进程,即在我的终端中输入以下内容:
ssh -L 8080:127.0.0.1:3306 -f -C -q -N -i ./password.pem user@host.com ssh -L 8080:127.0.0.1:3306 -f -C -q -N -i ./password.pem user@host.com
and then when I used mysqli connect I entered: 然后当我使用mysqli connect时我输入了:
new mysqli('127.0.0.1:8080','root','mypassword'); 新的mysqli('127.0.0.1:8080','root','mypassword');
Thanks so much for any assistance! 非常感谢您的帮助!
It sounds like you are trying to connect to your remote database from your local server (if I understand correctly). 听起来您正试图从本地服务器连接到远程数据库(如果我理解正确)。 You want to double check your security groups in AWS that they are allowing your computers ip address to connect to the server instance / that port 3306 is open to your pc.
您希望仔细检查AWS中的安全组,他们允许您的计算机IP地址连接到服务器实例/端口3306对您的PC开放。 If that is all set, then you should be able to connect to the instance using the public dns or elastic ip if it is an EC2 instance, or the endpoint if it is an RDS instance.
如果已全部设置,那么您应该能够使用公共DNS或弹性IP连接到实例(如果它是EC2实例),或端点(如果它是RDS实例)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.