Google app engine Google应用程序引擎不允许将点作为静态文件目录中的第一个字符吗
目前,我在GoogleAppEngine中有以下配置文件Google app engine Google应用程序引擎不允许将点作为静态文件目录中的第一个字符吗,google-app-engine,Google App Engine,目前,我在GoogleAppEngine中有以下配置文件 application: jstock-affiliate version: 1 runtime: python27 api_version: 1 threadsafe: true auto_id_policy: default handlers: - url: /.well-known static_dir: .well-known - url: /static static_dir: static - url: /.*
application: jstock-affiliate
version: 1
runtime: python27
api_version: 1
threadsafe: true
auto_id_policy: default
handlers:
- url: /.well-known
static_dir: .well-known
- url: /static
static_dir: static
- url: /.*
script: main.application
libraries:
- name: webapp2
version: latest
当我在本地访问以下URL时,两者都可以正常工作
http://localhost:9080/.well-known/a.txt - OK
http://localhost:9080/static/a.txt - OK
然而,在我部署到Google App Engine之后,对于文件夹。众所周知的
http://jstock-affiliate.appspot.com/.well-known/a.txt - ERROR
http://jstock-affiliate.appspot.com/static/a.txt - OK
我需要一个点作为文件夹名称中的第一个字符,因为
我可以知道如何解决这个问题吗?似乎Google App Engine在创建以点开头的文件夹时遇到了问题。下面的配置将有所帮助
handlers:
- url: /.well-known
static_dir: well-known
需要创建文件夹well-known
,而不是文件夹。well-known
新的App Engine Flex环境在App.yaml
中不提供“处理程序”配置。我能做到这一点的唯一方法是向nginx app.conf
文件添加location
指令,同时将著名的目录与app.yaml
中指定的文档根目录平行放置(基本上位于应用程序根目录):
我使用^ ~
匹配,因此禁止提供以点开头的目录的正则表达式规则不匹配。它应该可以工作。我已经将我的项目的。众所周知的静态目录命名为letsencrypt
,但我认为在应用程序中使用dotdir作为静态目录没有任何问题。一个小提示,最好使用转义点-url://\。众所周知
,因为url
param接受正则表达式,所以应该使用转义点来匹配点字符。除了换行符之外,一个未替换的点可以匹配任何单个字符。我认为您也可以通过指定这个/kwell known
url来访问众所周知的目录。请再次查看问题中的app.yaml
。你的答案适用吗?
location ^~ /.well-known/ {
alias /app/well-known/;
}