Google app engine Google应用程序引擎-如何以HTTPS for python运行服务器?

Google app engine Google应用程序引擎-如何以HTTPS for python运行服务器?,google-app-engine,web,https,Google App Engine,Web,Https,在运行Google App Engine时,可以以http方式运行,但如何以https方式运行呢 $ python2.7 /var/tmp/google_appengine/dev_appserver.py --host 0.0.0.0 /var/tmp/app INFO 2013-08-20 21:21:21,093 dispatcher.py:164] Starting module "default" running at: http://0.0.0.0:8080 INFO

在运行Google App Engine时,可以以http方式运行,但如何以https方式运行呢

$ python2.7 /var/tmp/google_appengine/dev_appserver.py --host 0.0.0.0 /var/tmp/app
INFO     2013-08-20 21:21:21,093 dispatcher.py:164] Starting module "default" running at: http://0.0.0.0:8080
INFO     2013-08-20 21:21:21,099 admin_server.py:117] Starting admin server at: http://localhost:8000
编辑:

步骤1:

I purchased a.crt and a.key from a service provider such as heart internet from UK.
步骤2:我将a.crt和a.key文件与内容放在一起

sun@sun-M14xR2:/var/tmp/private$ ls
a.crt  a.key
sun@sun-M14xR2:/var/tmp/private$ cat a.key a.crt > server.pem
sun@sun-M14xR2:/var/tmp/private$ ls
a.crt  a.key server.pem
sun@sun-M14xR2:/var/tmp/private$ openssl gendh >> server.pem
Generating DH parameters, 512 bit long safe prime, generator 2
This is going to take a long time
......................++*++*++*++*++*++*
sun@sun-M14xR2:/var/tmp/private$ stunnel -d 8443 -p server.pem -r localhost:8000 -f -P ''
2013.08.21 09:03:10 LOG5[5368:139785875400448]: stunnel 4.53 on x86_64-pc-linux-gnu platform
2013.08.21 09:03:10 LOG5[5368:139785875400448]: Compiled with OpenSSL 1.0.1 14 Mar 2012
2013.08.21 09:03:10 LOG5[5368:139785875400448]: Running  with OpenSSL 1.0.1c 10 May 2012
2013.08.21 09:03:10 LOG5[5368:139785875400448]: Update OpenSSL shared libraries or rebuild stunnel
2013.08.21 09:03:10 LOG5[5368:139785875400448]: Threading:PTHREAD SSL:+ENGINE+OCSP Auth:LIBWRAP Sockets:POLL+IPv6
2013.08.21 09:03:10 LOG5[5368:139785875400448]: Reading configuration from descriptor 3
2013.08.21 09:03:10 LOG4[5368:139785875400448]: Insecure file permissions on server.pem
2013.08.21 09:03:10 LOG5[5368:139785875400448]: Configuration successful

我相信应用程序引擎在部署时会自动作为Https运行。在本地,无法作为https运行

但是,您可以运行stunnel来模拟它

stunnel -d 8443 -p /path/to/ssl.pem -r localhost:8880 -f -P '' &
(您必须创建ssl.pem文件)(还假设服务器运行的端口是8880)

基本上,这将为您的应用程序提供一个类似ssl的代理。您将在浏览器中收到警告,但对于本地测试来说已经足够了

编辑:

不太清楚那里发生了什么。我忘了提到你需要使用 https://local host:8443
从浏览器连接时。

是否使用https作为前缀?(我问,因为我以前做过)是的-我使用https作为前缀,但运气不好,页面没有正确打开。启动模块“default”运行于:INFO 2013-08-20 21:21:21099 admin_server.py:117]启动管理服务器:看起来您实际上运行的是8080,只有admin运行于8000。你的stunnel命令应该在8080上是的-你是对的,我在8080上做了,但还是失败了。我想知道是不是“server.pem上不安全的文件权限”导致了stunnel或openSsh的停顿?您可以跟踪该错误消息并查看它是否能解决问题。您可以始终使用自签名证书。无需支付任何费用。