Solved

How to hide port 8080?

Posted on 2004-09-20
8
7,545 Views
Last Modified: 2012-08-13
I have apache2.050 and tomcat 5.5.  Apache uses port 80 and tomcat 8080.  Is there a way to hide port 8080?

Or can I map www.mysite.com:8080/mywebapp/  map to
www.mysite.com/mywebapp/ ?

Thanks
0
Comment
Question by:rdong
  • 4
  • 3
8 Comments
 
LVL 15

Expert Comment

by:samri
ID: 12110429
hi rdong,

technically, you could not hide port 8080 as it would be used by tomcat.  By default apache would bind to port 80, and tomcat would be using port 8080.  However, if you wish, you could configure your apache in such a way that it would accept request, then will redirect/proxied/rewite to the tomcat.

the quickest way to do is by using redirect, where you could use

Redirect /mywebapp http://www.mysite.com:8080/mywebapp/

(

Redirect would cause the URL location to change -- which the user would see the URL on the location bar to change to http://www.mysite.com:8080/mywebapp/

Next, you could use mod_rewrite and/or mod_proxy to use ReverseProxy mode to achive your goal:

PAQ: http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20319838.html
http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20319552.html
0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12110941
You can make redirection from apache httpd to tomcat using mod_jk
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk/aphowto.html
use only ajp connector and disable http connector on tomcat
0
 

Author Comment

by:rdong
ID: 12119097
Thank both for your response.  I want to try ramazanyich's suggestion first.

Apache is pretty new to me, so please bear with me...

I use windows xp.

I have tried to configure http.conf without success.

1. How to add  jk2 module to http.conf?
2. The document says to add this line to http.conf
Include /var/tomcat3/conf/jk/mod_jk.conf-aut

Then I actually add this line to http.conf:

Include C:/Program Files/Apache Software Foundation/Tomcat 5.5/conf/jk/mod_jk.conf-auto
I got an error when I restart apache:

"
Include takes one argument, Name of the config file to be included
Note the errors or messages above, and press the <ESC> key to exit."

3. Where do I put workers.properties file.  How to configure it?

Is that possible you can give me step by step?

Thanks you very much



 

0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12121491
Download mod_jk from apache site: http://apache.belnet.be/jakarta/tomcat-connectors/jk/binaries/win32/
copy mod_jk.dll into modules directory of you apache server.
Modify httpd.conf:
--------
LoadModule modules/mod_jk.dll
AddModule mod_jk.c
JkWorkersFile conf/workers.properties
JkLogFile log/mod_jk.log
JkMount /*.jsp worker1
----------

The 'JkMount' tells mod_jk to forward all requests for
JSP's  to the worker named worker1.

Create file workers.properties in conf directory of your Apache server:
---
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.1
worker.worker1.port=9009
worker.worker1.lbfactor=1
worker.worker1.local_worker=1
------

in your tomcat server.xml find <Connector> element with attribute which has Ajp13Connector inits value.
check the port attribute of that element and modify its value to 9009
Restart both tomcat and apache.


0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:rdong
ID: 12129820
Thanks for your help.

I got stuck here.

1. I followed your steps but when I started apache server it complained:

"LoadModule takes two arguments, a module name and the name of a shared object fi
le to load it from"

So I gave it a name jk_module. So the first line becomes
LoadModule jk_module modules/mod_jk.dll
I found that other module names are not working, how do you get the module name in the first place?

2. After the above being taked cared of, I got another error when restarting apache:

"Invalid command 'AddModule', perhaps mis-spelled or defined by a module not included in the server configuration"

What is mod_jk.c? How do you include it in the server configuration?

Could not go further, please shed some light on this. Also I am wondering, if everything works fine,
www.mysite.com/mywebapp/ will be pointing to www.mysite.com:8080/mywebapp?



0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12130590
remove AddModule line.
It is not necessary if LoadModule already exists.
AddModule directive used to load modules in some order if necessary.
0
 

Author Comment

by:rdong
ID: 12139257
Thanks,

I got both apache and tomcat restarted successfully. However can you tell me how can I map localhost:8080/mywebapp
to
localhost/mywebapp?

this is my workers.properties file
===========================
port=9009
host=127.0.0.1

# define the worker
[ajp13:localhost:9009]
channel=channel.socket:localhost:9009
group=lb
#
#[uri:/mywebapp/*]

group=lb

[status:]
info=Status worker, displays runtime information

[uri:/jkstatus/*]
info=The Tomcat /jkstatus handler
group=status:

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.1
worker.worker1.port=9009
worker.worker1.lbfactor=1
worker.worker1.local_worker=1
========================

This is server.xml in tomcat
=====================
................
  <Connector port="9009"
               enableLookups="false" redirectPort="8443" debug="0"
               protocol="AJP/1.3" />
........
========================

do I need to change anything in jk2.properties in tomcat?

Thanks so much
0
 
LVL 19

Accepted Solution

by:
ramazanyich earned 50 total points
ID: 12141018
add to your httpd.conf:
JkMount /mywebapp/* worker1
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now