【问题标题】:How to give public access to gCloud App Engine如何授予对 gCloud App Engine 的公共访问权限
【发布时间】:2021-02-16 17:57:26
【问题描述】:

我刚刚部署了一个 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 可供所有 google 用户使用?

我在这里错过了什么?

谢谢!

App.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;

【问题讨论】:

  • 嗨 Damien,您能分享您的 yaml 和 config.inc.php 文件吗?这有助于查看您的配置并查看那里是否有问题。
  • 完成!我添加了配置文件

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


【解决方案1】:

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

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

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

$cfg['blowfish_secret'] = '';

$cfg['Servers'][$i]['auth_type'] = 'cookie';

致以下:

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

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

【讨论】:

  • 我将 app.yaml 中的登录名更改为可选,并且可以正常工作!感谢您的宝贵时间!
猜你喜欢
  • 2016-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多