Solved

How to hide port 8080?

Posted on 2004-09-20
8
7,520 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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