Tomcat Httpd



Httpd

Tomcat and httpd configured in port 8080 and 80

Tomcat is a Java based web application container, is open source and entire free to use (Tomcat is released under the Apache software license). Tomcat is developed by a group of voluntary programmers. I have few questions regarding the Apache HTTPD server and the Tomcat web server port configurations. Through netstat and TOMCAT/conf/server.xml I understand that: 80 and 443 ports are used by Apache for HTTP and HTTPS requests respectively. 8080 and 8443 ports are used by Tomcat for HTTP and HTTPS requests respectively.

By: Emiley J Printer Friendly Format

It’s been almost 12 years I started using Apache Tomcat. I believe when I did my 1st under grade project, it was on Tomcat version 1.x. Now it’s already on version 8.0. Mostly I’ve been in touch with Tomcat Server in my daily work life, simply can’t live without it. On Crunchify we have already published almost 40 articles on Apache Tomcat. Apache is faster at serving static content than Tomcat. But unless you have a high traffic site, this point is useless. But in some scenarios, tomcat can be faster than Apache httpd. So benchmark YOUR site. Tomcat can perform at httpd speeds when using the proper connector (APR with sendFile enabled). Introduction Using Apache httpd as a proxy to an Apache Tomcat application container is a common setup. It comes with many use cases, the most trivial is serving static content from httpd, while providing services implementing heavy business logic from an application written in Java that resides in the Tomcat container.

When you install Tomcat in your server, by default it uses port 8080. Typically in a linux system, you can install apache2 or httpd as a web server that handles the default port 80 and then uses mod_proxy to send requests to Tomcat at port 8080 for sites hosted in Tomcat.

httpd (or apache2) are great for hosting multiple websites (multiple domains) in a single server. In this example, we will install, httpd in port 80 and Tomcat7 in port 8080 and then configure both of them to handle requests seamlessly.

Install and configure httpd

  • yum install httpdYou could ofcourse use apt-get instead of yum depending on your platform
  • vim /etc/httpd/conf/httpd.conf
    Look for the following modules and enable them if they are not already enabled
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    Then uncomment, the following line
    NameVirtualHost *:80
    Uncomment the following lines at the bottom and change it to point to your default domain.
    Save and close the file by pressing 'Esc' and the typing :wq! and Enter.
  • service httpd start

Intall and configure tomcat7

  • yum install tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps
  • under /etc/httpd/conf.d create a file named mytomcatapp.conf and copy the below code

You have now installed both httpd and tomcat7 and configured them. You now have to start/restart both services

service httpd restart
service tomcat7 restart

Now when you goto your www.yourdefaultdomain.com in your browser, the request is direclty handled by httpd service and the index file from your /var/www/html folder will be returned to the browser.

If you goto www.myanotherdomain.com in your browser, the request will be forwarded by httpd service to the tomcat7 internally and your tomcat application will serve the pages.

The domains www.myanotherdomain.com and www.yourdefaultdomain.com are used for illustration purposes only. You have to use your own valid domains, and the DNS A records have to be created to point to the IP address of your server


Most Viewed Articles (in Java )

Latest Articles (in Java)

Comment on this tutorial

    categories

Subscribe to Tutorials

Related Tutorials

Tomcat Httpd

Archived Comments

1. che, hale this adverts that are there in this web
View Tutorial By: kelibone at 2015-03-06 08:10:29

2. Evaluating where you are based on three valuable s
View Tutorial By: _____ at 2017-01-04 05:12:27

3. xrdfvm
View Tutorial By: bgutecv at 2017-02-21 20:59:50

4. wqwgaw
View Tutorial By: silxea at 2017-02-26 00:51:04

5. kqh98q
View Tutorial By: xlxm00 at 2017-03-01 03:05:29

6. ksbhqj
View Tutorial By: yfi16c at 2017-03-01 22:49:40

7. nulchx
View Tutorial By: vkx76j at 2017-03-03 02:56:23

8. ewlx01
View Tutorial By: prleln at 2017-03-03 06:07:15

Tomcat Httpd Configuration

9. ebxarrm
View Tutorial By: gkxoot at 2017-03-08 10:13:01

10. viagra without a doctors approval
View Tutorial By: viagra without a doctor prescription at 2017-03-13 09:22:07

Tomcat Httpd.conf Location

11. fck39d
View Tutorial By: btyg74 at 2017-03-29 21:26:12

Tomcat Httpd Proxy

12. kculol
View Tutorial By: nnz51s at 2017-04-01 08:16:23

13. zyquah
View Tutorial By: jkuq84 at 2017-04-02 01:56:13

14. ivs39w
View Tutorial By: aufbvs at 2017-04-02 20:41:56

15. Myye62t
View Tutorial By: Mgwkjra at 2017-04-02 21:12:44

16. wih69n
View Tutorial By: lwmdvd at 2017-04-03 21:32:03

17. alqmwx
View Tutorial By: rthrdi at 2017-04-04 19:12:17

Tomcat Httpd

18. cev32o
View Tutorial By: eoy22f at 2017-04-07 00:36:42

19. orbi48
View Tutorial By: mrcxyl at 2017-04-11 09:36:26

20. JasonNix
View Tutorial By: JasonNix at 2017-04-13 08:43:50

21. elftvk
View Tutorial By: jfgwaq at 2017-04-16 04:05:18

22. njinhs
View Tutorial By: qagy28 at 2017-04-16 08:18:38

23. phci56
View Tutorial By: dctukj at 2017-04-17 00:41:07

24. Iinujtyd
View Tutorial By: Iivns74 at 2017-04-18 00:04:35

25. ffce15
View Tutorial By: quad67 at 2017-04-18 12:44:03

26. Irhi47u
View Tutorial By: Iikdbhs at 2017-04-19 02:42:30

27. octmlx
View Tutorial By: mqmsin at 2017-04-20 00:29:04

Tomcat

28. Ixoxpcem
View Tutorial By: Ivmwrbno at 2017-04-20 18:38:01

29. gnmijp
View Tutorial By: rat46o at 2017-04-21 06:24:54