
내 목표는 클라이언트가 연결을 통해 연결하도록 하는 것이지만 https
Apache는 이를 통해 동일한 서버에서 실행되는 내 응용 프로그램에 이를 제공합니다 http
. 다음은 최소한의 Apache 구성 파일입니다(수신되는 http 요청의 경우 모든 요청을 https로 리디렉션하기만 하면 됩니다).
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>
분명히 gunicorn은 다음을 실행하고 듣고 있습니다 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
하지만 브라우저에서는 NetworkError: 404 NOT FOUND - https://abc.com/stream/
. 도와주세요. 막혔어요. 정말 감사드립니다.
답변1
이런! 그것은 어리석은 실수였습니다. 및 ProxyPass
는 다음 ProxyPassReverse
과 같아야 합니다.
ProxyPass /stream/ http://127.0.0.1:8001/stream/ #<-- was missing /stream/ here
ProxyPassReverse /stream/ http://127.0.0.1:8001/stream/