A Java site, using Tomcat server, you need to the site's CSS, images, JS need to separate. With a different domain name, you will encounter cross-domain situations. To do this, the Apache proxy is used to implement the detach work
CSS, images, JS resources all put to
src.test.com/css/...
Src.test.com/images/...
src.test.com/js/...
Java Site Tomcat Server access method
ajp://127.0.0.1:8009/
Actually, it's http://127.0.0.1:8080/.
Apache httpd.conf Configuration
ServerName mnr.test.com
Rewriteengine on
Rewriterule ^/(. *) ajp://127.0.0.1:8009/sub/$1 [P]
Then access the site through the http://sub.test.com way
Because CSS, images, JS resources are independent domain names, it may be on other servers, but must be in the subdomain domain name method to avoid cross-domain situation.
Restart Apache to
Call the corresponding relationship:
Sub.test.com/css src.test.com/css/...
Sub.test.com/images src.test.com/images/...
Sub.test.com/js src.test.com/js/...
sub.test.com resources are access to the resources under the Tomcat directory
This article links http://www.cxybl.com/html/wyzz/CSS/20121227/35249.html
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.