如何公开访问 gCloud App Engine

时间:2021-02-16 17:57:26

标签: google-app-engine google-cloud-platform

我刚刚部署了一个 App Engine 应用程序,phpMyAdmin 连接到 Cloud SQL 数据库。 当我使用它时,一切正常。

我想将这个应用程序分享给我的学生,但我不知道如何让他们访问 https 资源。 https://-dot-.ue.r.appspot.com/index.php 我尝试了以下方法:

禁用 IAP:学生看到“您的客户无权获取 URL /”

使用 allUsers 启用 IAP:查看器:学生看到一个页面,上面写着“您没有权限.. 联系管理员”

使用“allAuthenticated User Viewer”启用 IAP:同样的错误

使用“IAP-secured Web App User”角色启用 IAP:相同错误

我真的对授予访问权限感到迷茫。我认为默认情况下我的 App Engine 对所有谷歌用户都可用?

我在这里遗漏了什么?

谢谢!

应用程序.yaml:

service: phpmyadmin
runtime: php55
api_version: 1
handlers:
- url: /(.+\.(ico|jpg|png|gif))$
  static_files: \1
  upload: (.+\.(ico|jpg|png|gif))$
  application_readable: true
- url: /(.+\.(htm|html|css|js))$
  static_files: \1
  upload: (.+\.(htm|html|css|js))$
  application_readable: true
- url: /(.+\.php)$
  script: \1
  login: admin
- url: /.*
  script: index.php
  login: admin

config.inc.php :

<?php


$cfg['blowfish_secret'] = '<my-secret>'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

// Change this to use the project and instance that you've created.
$host = '/cloudsql/<my-app>:europe-west1:<my-db>';
$type = 'socket';

/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['socket'] = $host;
$cfg['Servers'][$i]['connect_type'] = $type;
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
/*
 * End of servers configuration
 */
$cfg['TempDir'] =  "/tmp/";

/*
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

/*
* Other settings
*/
$cfg['PmaNoRelation_DisableWarning'] = true;
$cfg['ExecTimeLimit'] = 60;
$cfg['CheckConfigurationPermissions'] = false;

1 个答案:

答案 0 :(得分:0)

检查您共享的文件后,我注意到以下几点:

关于您的 app.yaml,the login option 确定 URL 处理程序是否要求用户登录。当登录设置为“管理员”时,用户需要登录并且用户需要是行政人员。您可以完全删除登录名或将登录名设置为“可选”。 “可选”选项不需要用户登录即可访问 URL。

另一方面,关于 config.inc.php 文件,这可能是由 phpMyAdmin 部署引起的。所以,请更改这些行

<块引用>

$cfg['blowfish_secret'] = ' <我的秘密> ';

$cfg['服务器'][$i]['auth_type'] = 'cookie';

以下内容:

<块引用>

$cfg['blowfish_secret'] = '';
$cfg['Servers'][$i]['auth_type'] ='http';

更改并保存文件后,请继续使用 gcloud 命令“gcloud app deploy --version=new”重新部署您的 phpMyAdmin,然后再次尝试访问。

相关问题