简体   繁体   English

如何将客户端连接到Elastic Beanstalk(AWS)上的PHP应用程序

[英]How to connect a client to a PHP application on Elastic Beanstalk (AWS)

I'm trying to create a basic Client-Server environment. 我正在尝试创建一个基本的客户端-服务器环境。

Here are the details: 详细信息如下:

Client: I created an Android app that opens an HTTP connection: 客户端:我创建了一个可打开HTTP连接的Android应用:

        String url = "http://MYAPPNAME.elasticbeanstalk.com"; 
        DefaultHttpClient httpClient = new DefaultHttpClient(); 

        HttpGet httpGet = new HttpGet(url);

        HttpResponse httpResponse = httpClient.execute(httpGet);

        httpEntity = httpResponse.getEntity();

Server: I created: 服务器:我创建了:

  1. RDS instance with one table called "users". 具有一个称为“用户”的表的RDS实例。

  2. Elastic Beanstalk application. Elastic Beanstalk应用程序。 I deployed a PHP file (in a Zip file). 我部署了一个PHP文件(在Zip文件中)。 The PHP file contains a connection to the DB (RDS) and executes the statement: "SELECT * FROM users" 该PHP文件包含与DB(RDS)的连接,并执行以下语句:“ SELECT * FROM users”

I Get an error in the first connection between the client and the PHP application: 我在客户端和PHP应用程序之间的第一个连接中遇到错误:

错误

The security group allows everyone to get to this instance: 安全组允许所有人访问此实例:

80 tcp 0.0.0.0/0 80吨0.0.0.0/0

Is someone knows what could be the problem? 有人知道可能是什么问题吗?

You are trying to access to the root directory ("/"). 您正在尝试访问根目录(“ /”)。 If you could access in that easy way, everybody could. 如果您能够以这种简单的方式访问,那么每个人都可以。 Nobody (without authentication) should be able to access. 任何人(未经身份验证)都不能访问。

Change the path to your path ( http://MYAPPNAME.elasticbeanstalk.com/ ....." and/or define an entry point. 将路径更改为您的路径( http://MYAPPNAME.elasticbeanstalk.com/ .....“和/或定义一个入口点。

I hope this helps ;) 我希望这有帮助 ;)

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

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