Amazon ec2 当使用apt get命令安装时,如何在Amazon EC2 Ubuntu12.04上将请求从apache2重定向到tomcat7
我使用以下命令在Amazon EC2 Ubuntu12.04上安装了Apache2和Tomcat7:Amazon ec2 当使用apt get命令安装时,如何在Amazon EC2 Ubuntu12.04上将请求从apache2重定向到tomcat7,amazon-ec2,apache2,amazon,ubuntu-12.04,Amazon Ec2,Apache2,Amazon,Ubuntu 12.04,我使用以下命令在Amazon EC2 Ubuntu12.04上安装了Apache2和Tomcat7: sudo apt-get install apache2 sudo apt-get install tomcat7 现在是tomcat CATALINA\u HOME是/usr/share/tomcat7(bin和libtomcat文件夹) CATALINA_BASE是/var/lib/tomcat7(webapps文件夹在那里) 对于Apache Apache模块:/etc/apache2/
sudo apt-get install apache2
sudo apt-get install tomcat7
现在是tomcatCATALINA\u HOME
是/usr/share/tomcat7
(bin
和lib
tomcat文件夹)CATALINA_BASE
是/var/lib/tomcat7
(webapps
文件夹在那里)
对于ApacheApache模块:
/etc/apache2/mods已启用
虚拟主机:/etc/apache2/已启用站点
配置文件:/etc/apache2/apache2.conf
Apache配置文件httpd.conf
为空
如何将所有请求从Apache2重定向到Tomcat7?
例如,如果我在浏览器中输入10.121.143.116:80
,它将点击10.121.143.116:8080
请提出建议,因为我在谷歌上发现了过去两个月以来,发现太多的解决方案都混淆了,无法理解单一的最佳工作解决方案。希望这会有所帮助
首先,在/etc/apache2/sites available中创建sampleweb文件
sudotouch/etc/apache2/sites available/proxy\u your\u sampleweb
#For forwarding everything
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
#For forwarding only required contexts
ProxyRequests Off
ProxyPass /sampleweb http://localhost:8080/sampleweb
ProxyPassReverse /sampleweb http://localhost:8080/sampleweb
其次,在上面的sampleweb主机文件中添加以下内容。
sudo vi/etc/apache2/sites available/proxy\u your\u sampleweb
#For forwarding everything
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
#For forwarding only required contexts
ProxyRequests Off
ProxyPass /sampleweb http://localhost:8080/sampleweb
ProxyPassReverse /sampleweb http://localhost:8080/sampleweb
mod_proxy
是您所需要的。查看详细信息感谢您的回复slayedbylucifer并建议mod_代理。我尝试在httpd.conf文件中进行配置,该文件位于/etc/apache2/httpd.conf,但该文件为空。当我使用apt-get命令行安装apache和tomcat时。请稍作详细解释。