我打算使用单个 VPS 将多个低流量 CherryPy 应用程序部署为子目录;如:example.com/app1
,example.com/app2
等等。
在研究了 WSGI 部署之后,看起来部署应用程序的首选方法是在反向代理设置中使用 WSGI 服务器(Gunicorn、uWSGI 等)和 NGinx。串联使用两个网络服务器似乎有点矫枉过正——尤其是因为我的 CherryPy 应用程序本身就是一个网络服务器——但我不想因为它无处不在而忽视这个想法。我当然不是专家,所以我想讨论一下。
我看到三个选项:
我的问题:
任何和所有的建议表示赞赏,谢谢。
我需要对我的应用程序的一部分使用 apache 基本身份验证。我想从 apache 获取经过身份验证的用户名,但似乎找不到访问它的位置。我可以在 apache 日志中看到用户名,所以我知道它在某处。用户通过 apache 身份验证后,请求将通过代理发送到cherrypy 服务器。
这是我的 apache vhost 配置部分:
<Location /ical>
AuthType Basic
AuthBasicProvider ldap
AuthName "Example Calendar Login"
AuthLDAPUrl "ldaps://ldap.example.net/ou=People,dc=example,dc=net?uid"
Require valid-user
ProxyPass http://localhost:8082/
ProxyPassReverse http://localhost:8082/
SetEnv proxy-nokeepalive 1
</Location>
Run Code Online (Sandbox Code Playgroud)
用户身份验证和代理位工作正常。请求通过身份验证并发送到cherrypy后,这是我在cherrypy中的标头:
(Pdb) pp cherrypy.request.headers
{'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Accept-Encoding': 'gzip,deflate',
'Accept-Language': 'en-us,en;q=0.5',
'Authorization': 'Basic xxxxxxxxxxx',
'Connection': 'close',
'Host': 'sub.example.net',
'If-None-Match': 'e5b0879ce68fcce5b960ce4281c8d706',
'Remote-Addr': '10.132.32.86',
'User-Agent': 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10',
'X-Forwarded-For': 'xx.xx.xx.xx, xx.xx.xx.xx',
'X-Forwarded-Host': 'sub.example.net, sub.example.net',
'X-Forwarded-Server': 'sub.example.net, sub'} …
Run Code Online (Sandbox Code Playgroud) 我有多个 Web 应用程序在它们自己的 http 服务器上运行,例如端口 8080 上的 ruby/rails 应用程序和 8081 端口上的 python/cherrypy 应用程序。
是否可以通过单个端口地址使这些透明可用?也许通过添加转换所有请求的第三个 http 服务器(例如http://localhost/app1和http://localhost/app2)。我选择的平台是 Linux
我有一个简单的基于 Python 的 Web 服务器,在使用 docker compose 设置的容器中运行,该容器公开端口 8080。
\n当我 docker-compose up 服务时,它报告端口已公开,但端口未向外部公开。
\n接下来我应该看什么诊断?
\n这是一个典型的运行
\n\xe2\x9e\x9c demo04 sudo docker-compose up -d\nRecreating leagueweb_database ... done\nRecreating leagueweb_server ... done\n
Run Code Online (Sandbox Code Playgroud)\nPython Web 服务器(使用 CherryPy)报告它已正常启动并打开端口 8080。
\nleagueweb_server | [25/Jan/2022:11:27:21] ENGINE Serving on http://127.0.0.1:8080\n
Run Code Online (Sandbox Code Playgroud)\nDocker 报告它正在转发端口 8080
\n\xe2\x9e\x9c demo04 sudo docker-compose ps\n Name Command State Ports\n------------------------------------------------------------------------------------------------------------------------\nleagueweb_database /entrypoint.sh mysqld Up (healthy) 0.0.0.0:3306->3306/tcp,:::3306->3306/tcp, 33060/tcp\nleagueweb_server ./wait-for-it.sh database: ... Up 0.0.0.0:8080->8080/tcp,:::8080->8080/tcp\n
Run Code Online (Sandbox Code Playgroud)\n从远程 PC 进行测试,我可以看到虽然端口 3306 是外部开放的,但端口 8080 却没有。
\nPS …
Run Code Online (Sandbox Code Playgroud)