UbuntuServer configures the application of Apache2 proxy Tomcat

Source: Internet
Author: User
Environment: UbuntuServer11.0464-bit. apache2.2.17 is usually configured on the server for apache to use the default port 80, which can be accessed through http: // [serverIP]. tomcat usually uses special ports, such as 8080, access through http: // [serverIP]: 8080/[appName]

Environment: 64-bit Ubuntu Server 11.04, Apache 2.2.17

Apache is usually configured on the server to use the default port 80, which can be accessed through http: // [serverIP]. tomcat usually uses a special port, such as 8080, through http: // [serverIP]: 8080/[appName] to access the application.

To directly access tomcat applications without using a port, you can configure apache as follows:
1) configure the httpd. conf file
$ Sudo vi/etc/apache2/httpd. conf Add the following content:
 
  
ServerName 192.168.0.1

ProxyPass /nexus http://192.168.0.1:8080/nexus
ProxyPassReverse /nexus http://192.168.0.1:8080/nexus

ProxyPass /bctest http://192.168.0.1:8080/bctest
ProxyPassReverse /bctest http://192.168.0.1:8080/bctest

ProxyPreserveHost On
Note: Both nexus and bctest are examples of [appName]. In the preceding example, two applications under tomcat are accessed through apache. 192.168.0.1 is the IP address of the tomcat server, modify the settings as needed.
2) Configure apache2 to load proxy-related modulesRun "$ ls/etc/apache2/mod-enabled" to check whether "proxy" exists. load "and" proxy_http.load ". If not, run the following two commands to add them: $ sudo ln/etc/apache2/mod-available/proxy. load/etc/apache2/mod-enabled/proxy. load $ sudo ln/etc/apache2/mod-available/proxy_http.load/etc/apache2/mod-enabled/proxy_http.load
3) Restart The apache2 service. $ Sudo service apache2 restart

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.