Solved

How to hide port 8080?

Posted on 2004-09-20
8
7,602 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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
 

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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
phpPgAdmin problem 14 274
DNS CNAME records visibility on a web server 2 68
phpmyadmin memory error 55 92
Centos webserver sending tons of spam 27 33
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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