Apache als Reverse-Proxy funktioniert nicht für Gunicorn

Apache als Reverse-Proxy funktioniert nicht für Gunicorn

Mein Ziel ist, dass der Client eine Verbindung über httpseine Verbindung herstellt, Apache sie aber meiner Anwendung bereitstellt, die auf demselben Server läuft http. Hier ist meine minimalistische Apache-Konfigurationsdatei (für eingehende HTTP-Anfragen leite ich einfach alle Anfragen auf HTTPS um):

NameVirtualHost 1.2.3.4:443
NameVirtualHost 1.2.3.4:80

LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so

<VirtualHost 1.2.3.4:443>
  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin [email protected]
  ServerName abc.com
  ServerAlias www.abc.com
  RequestReadTimeout header=90 body=90

  DocumentRoot /path/to/my/project
  LogLevel warn
  WSGIDaemonProcess abc_ssl processes=2 maximum-requests=500 threads=10
  WSGIProcessGroup abc_ssl
  WSGIScriptAlias / /path/to/my/project.wsgi
  WSGIApplicationGroup %{GLOBAL}

  SSLEngine on
  SSLCertificateFile /home/django/.ssh/abc.crt
  SSLCertificateKeyFile /home/django/.ssh/server.key
  SSLCertificateChainFile /home/django/.ssh/abc.ca-bundle

  RequestHeader set X-FORWARDED-SSL "on"
  RequestHeader set X-FORWARDED_PROTO "https"
  ProxyRequests off
  ProxyPreserveHost on

  <Location /stream/>
      Order Allow,Deny
      Allow from All
  </Location>

  ProxyPass /stream/ http://127.0.0.1:8001/
  ProxyPassReverse /stream/ http://127.0.0.1:8001/

</VirtualHost>

Offensichtlich läuft das Gunicorn und hört zu http://127.0.0.1:8001/:

2013-08-31 05:05:51 [15025] [INFO] Starting gunicorn 0.17.2
2013-08-31 05:05:51 [15025] [INFO] Listening at: http://127.0.0.1:8001 (15025)
2013-08-31 05:05:51 [15025] [INFO] Using worker: eventlet
2013-08-31 05:05:51 [15044] [INFO] Booting worker with pid: 15044
2013-08-31 05:05:51 [15045] [INFO] Booting worker with pid: 15045
2013-08-31 05:05:51 [15046] [INFO] Booting worker with pid: 15046

Aber im Browser kann ich nur sehen NetworkError: 404 NOT FOUND - https://abc.com/stream/. Bitte helfen Sie mir, ich stecke fest, das weiß ich wirklich zu schätzen.

Antwort1

Ups! Das war ein dummer Fehler. Das „ ProxyPassund“ ProxyPassReversesollte lauten:

ProxyPass /stream/ http://127.0.0.1:8001/stream/ #<-- was missing /stream/ here
ProxyPassReverse /stream/ http://127.0.0.1:8001/stream/

verwandte Informationen