我想要的是 访问 news.test.com , 实际访问的是 tomcat 下面的news 项目 ,访问 forum.test.com ,实际访问的是 tomcat 下面的 luntan 项目,但是浏览器地址 栏url news.test.com 、forum.test.com 不变 ,不要变成 news.test.com/news 或者 forum.test.com/luntan 这样的,如何配置? 请教
谢谢各位的回答,已经解决了。 需要在tomcat里面配置虚拟host。 host名称为需要访问的域名。
path= docbase=/opt/tomcat/webapps/news . 如果访问首页域名后面不加访问路径的话。path需要为“”。 docbase 指向项目名称。 在此与大家分享下。再次感谢各位的回答、^_^
server{ listen 80; server_name news.test.com;//前台访问地址 root {web_root_path}/news; access_log {log_root_path}/news.log; location /{ proxy_pass http://news; //tomcat后台处理地址 } }server{ listen 80; server_name forum.test.com;//前台访问地址 root {web_root_path}/forum; access_log {log_root_path}/forum.log; location /{ proxy_pass http://forum; //tomcat后台处理地址 } }
以上就介绍了nginx tomcat 配置 多个 二级域名 多个项目,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。