我無法正確配置上下文tomcat應用程序的我的apache2反向代理。Apache2 ProxPass反向與tomcat重定向和上下文
我在瀏覽器中使用URL www.projet-okinawa.ch來從外部訪問應用程序。
我的tcp端口80被iptables路由到8080。
(sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080)
我所定義的虛擬主機捕捉從端口8080的URL和www.projet-okinawa.ch請求重定向到SSL端口。
<VirtualHost *:8080>
ServerName www.projet-okinawa.ch
ServerAlias projet-okinawa.ch
Redirect permanent/https://www.projet-okinawa.ch:8443/
</VirtualHost>
I defined a second virtual host to catch the same url from the port 8443 that enable ssl and manage the reverse proxy.
<VirtualHost *:8443>
ServerName www.projet-okinawa.ch
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass/http://web.projet-okinawa.org:8081/okinawa
ProxyPassReverse/http://web.projet-okinawa.org:8081/okinawa
<Location />
Order allow,deny
Allow from all
</Location>
SSLCertificateFile /etc/letsencrypt/live/os-vps276.projet-okinawa.org/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/os-vps276.projet-okinawa.org/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/os-vps276.projet-okinawa.org/chain.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
您可能會注意到設置爲/ okinawa的Web應用程序上下文。
我的tomcat配置正在偵聽8080,8081和8443 tcp端口。
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
proxyName="www.projet-okinawa.ch" proxyPort="8443" scheme="https" />
<Connector port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150"
SSLEnabled="true"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS"
URIEncoding="UTF-8"
keystoreFile={keystore} keystorePass={password} />
該web應用程序在上下文/沖繩島上的Catalina localhost引擎上執行。上下文不是通過使用上下文描述符而是通過自動部署來定義的。該應用程序正確執行,可通過端口8080在內部訪問(例如:http://web.projet-okinawa.org/okinawa/participatewithus.html)。
當通過代理使用www.projet-okinawa.ch訪問它時,我收到了HTTP狀態404 -/okinawaokinawa /異常。
我測試了許多不同的方式來配置反向代理,但沒有成功。我不明白爲什麼返回的網址不支持www.projet-okinawa.ch而沒有重複的上下文。
任何幫助,歡迎。