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