Khan
Khan

Reputation: 1518

Apache server and tomcat server

I have a server with Apache server and tomcat server running.

As i know so far, Apache server has also php running and is doing the Web front-end.

Tomcat server is running servlets doing some business logic and hibernate framework for mySQL database.

Now I'm a little bit confused. Can both of the server receive HTTP requests? like servlet is receiving https requests and also my apache server from a webpage?

And both can connect to the database- apache server with php and as I mentioned tomcat with servlets at the same time?

Upvotes: 0

Views: 208

Answers (1)

olikaf
olikaf

Reputation: 601

PHP is an used as an Apache module.

But for Tomcat, you have 2 solutions :

1 : You can use Tomcats HTTP connector to handle HTTP requests. As long as you don't use the same port as the one used by Apache, no issue.

2 : But you can also use Tomcat as an Apache extension. In this case, Apache handles the static HTML, Authentication, ... See http://www.ntu.edu.sg/home/ehchua/programming/howto/apacheplustomcat_howto.html

The second approach is much better, as you have only one HTTP server to handle things like authentication for exemple.

Regarding the database connection, yes both can connect at the same time. Even with the same user, just different sessions in this case.

Upvotes: 2

Related Questions