3

在运行 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
4

1 回答 1

5

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

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

stunnel -d 8443 -p /path/to/ssl.pem -r localhost:8880 -f -P '' &

(您必须创建 ssl.pem 文件)(还假设 8880 是您的服务器运行的端口)

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

编辑:

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

于 2013-08-20T21:56:20.600 回答