Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to configurating two services

Status
Not open for further replies.

petersJazz

Programmer
Jan 28, 2002
222
EU
I'd like to have two different services under Apache/Resin. The first is the production site under port 80 and having /home/webdocs as main catalog. The second is test site under port 8080 and having /home/webdocs/test/ as main catalog.

How do I set it up in apache (httpd.conf)?

In resin.conf a have written:

Code:
<!--
  -- A sample Apache configuration
  -->
<caucho.com>
  <!-- <log id='/' href='stderr:'/> -->

  <http-server app-dir='/home/webdocs/' class-update-interval='2'>
    <srun port='6802'/>

    <!-- automatically compile Java in WEB-INF -->
    <classpath id='WEB-INF/classes' source='WEB-INF/classes'/>

    <error-log id='log/error-prodmiljo.log'/>
  </http-server>
  <http-server app-dir='/home/webdocs/projektplatsen-testmlijo' class-update-interval='2'>
    <srun port='6803'/>

    <!-- automatically compile Java in WEB-INF -->
    <classpath id='WEB-INF/classes' source='WEB-INF/classes'/>

    <error-log id='log/error-testmiljo.log'/>
  </http-server>
</caucho.com>
 
Make sure you are not binding to any port with Port 80 or Listen 80. Then in your vhost container put the port after the ip (VirtaulHost xxx.xx.x.xx:8080). Why do you want to use different ports?
 
Why do you want to use different ports?

Good question. What Im trying to do is to have the production system runing on port 80 (and 443 SSL) and test system on port 8080 (or thatever). I want to keep the systems apart, can that be done in another way than different ports?

My problems are:
1. Different ports, I put that into Apache config file (httpd.conf)
2. Different document roots (jsp and html), I put that into Apache config file (httpd.conf)
3. Different java code, the code is in different Jar files, how do I adress that, for the moment they are in the Resin lib catalog but that dont seem to work, problem is Resin will take the first class it finds in say Prod.jar when I want it to take class from Test.jar.
4. Different databases, that is controlled in config file that Java code reads. But how can I adress the document root in my java program?
 
I have found out the answer to question 4.

String configFileName = (request.getServerPort() == 8080 ? &quot;config-test.conf&quot; : &quot;config-prod.conf&quot;);

And then put the files config-test.conf and config-prod.conf in resin root catalog.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top