配置反向代理后Django Web应用无法正常运行的问题求助
配置反向代理后Django Web应用无法正常运行的问题求助
大家好,我碰到了一个反向代理相关的问题,想请各位帮忙看看。
我的Django Web应用和另一台服务器共用外部的80和443端口,不启用反向代理的时候localhost运行完全正常,但一旦开启反向代理,就会出现各种错误,根本没法正常访问。
我的reverse-proxy.conf配置内容如下:
# SSL Certificate and other SSL configurations SSLProxyEngine on ProxyRequests on SSLProxyVerify require SSLProxyCheckPeerCN on SSLProxyCheckPeerName on SSLProxyCheckPeerExpire on ProxyPreserveHost on RequestHeader set X-Forwarded-Proto https # Reverse Proxy Configuration ProxyPass "/" "https://192.168.1.83/" ProxyPassReverse "/" "https://192.168.1.83/" # Additional SSL configurations if needed
我已经配置了把所有HTTP请求重定向到HTTPS,并且在我的SSL-HTTPS配置文件里引入了上面的代理配置。当我注释掉Include .../reverse-proxy.conf这一行时,网站运行完全正常,但启用反向代理后,就出现了以下错误:
Apache错误日志:
[Thu Jan 18 07:09:39.835368 2024] [ssl:error] [pid 46505:tid 133251102926528] [remote 192.168.1.83:443] AH02039: Certificate Verification: Error (20): unable to get local issuer certificate [Thu Jan 18 07:09:39.835470 2024] [ssl:error] [pid 46505:tid 133251102926528] [remote 192.168.1.83:443] AH02040: Certificate Verification: Certificate Chain too long (chain has 2 certificates, but maximum allowed are only 1) [Thu Jan 18 07:09:39.835773 2024] [proxy:error] [pid 46505:tid 133251102926528] (20014)Internal error (specific information not available): [client 119.74.38.81:51224] AH01084: pass request body failed to 192.168.1.83:443 (192.168.1.83), referer: https://acupunctureclassique.duckdns.org/ [Thu Jan 18 07:09:39.835832 2024] [proxy:error] [pid 46505:tid 133251102926528] [client 119.74.38.81:51224] AH00898: Error during SSL Handshake with remote server returned by /login/, referer: https://acupunctureclassique.duckdns.org/ [Thu Jan 18 07:09:39.835861 2024] [proxy_http:error] [pid 46505:tid 133251102926528] [client 119.74.38.81:51224] AH01097: pass request body failed to 192.168.1.83:443 (192.168.1.83) from 119.74.38.81 (), referer: https://acupunctureclassique.duckdns.org/
前端显示的错误:
Proxy Error
The proxy server could not handle the request
Reason: Error during SSL Handshake with remote server
Apache/2.4.58 (Ubuntu) Server at acupunctureclassique.duckdns.org Port 443
另外补充一下apachectl -S的输出信息,方便大家排查:
VirtualHost configuration: *:443 acupunctureclassique.duckdns.org (/etc/apache2/sites-enabled/acu-le-ssl.conf:2) *:80 acupunctureclassique.duckdns.org (/etc/apache2/sites-enabled/acu.conf:1) ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2/error.log" Mutex ssl-stapling: using_defaults Mutex proxy: using_defaults Mutex ssl-cache: using_defaults Mutex default: dir="/var/run/apache2/" mechanism=default Mutex watchdog-callback: using_defaults Mutex rewrite-map: using_defaults Mutex ssl-stapling-refresh: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="www-data" id=33 not_used Group: name="www-data" id=33 not_used
备注:内容来源于stack exchange,提问作者Sati
相关产品推荐
相关产品推荐

