LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-27-2009, 12:02 PM   #1
digity
Member
 
Registered: Apr 2005
Posts: 105

Rep: Reputation: 15
create a forward in Apache


I have a dyndns hostname (example.dyndns.org) pointing to my web server (Ubuntu/Apache 2). I have another web server (tomcat) running on that same box on port 65123. how do I step up a folder/alias on the Apache server to point to the Tomcat server (example.dyndns.org/webapp forwards to example.dyndns.org:65123/webapp)?
 
Old 08-27-2009, 12:31 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,843

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
You can do it with mod_rewrite. Add the following in tha apache config and restart the server:
Code:
RewriteEngine on

RewriteCond %{REQUEST_URI} ^/webapp
RewriteRule ^(.*)$ http://example.dyndns.org:65123/webapp
If you have to enable mod_rewrite you can run:
Code:
sudo a2enmod rewrite
Regards
 
Old 08-27-2009, 06:51 PM   #3
digity
Member
 
Registered: Apr 2005
Posts: 105

Original Poster
Rep: Reputation: 15
i was able to enable mod_rewrite successfully but the forward didn't take. I put the code in /etc/apache2/apache2.conf and httpd.conf (restarted Apache between tries of course) and neither worked. Any ideas?
 
Old 08-28-2009, 12:17 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,843

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
Since I'm not using Ubuntu, I suggest you to take a look at this post.
It looks like you have to edit /etc/apache2/sites-enabled/000-default and add in DocumentRoot part (if not already there):
Quote:
Options FollowSymLinks
AllowOverride all
I guess that you can put the rewrite directives in the same file, or you can use a .htaccess, as in the example above (that's why the "AllowOverride All" is needed).

Regards
 
Old 08-28-2009, 05:46 PM   #5
digity
Member
 
Registered: Apr 2005
Posts: 105

Original Poster
Rep: Reputation: 15
Thanx! I got it working using mainly what you suggested. Here's how I got it working (in case anyone else is trying to accomplish this):

[1] I enabled mod_write with: sudo a2enmod rewrite
[2] Created the folder "webapp" in server document root (/var/www)
[3] Made the following changes to /etc/apache2/sites-enabled/000-default:

- Changed "AllowOverride None" to "AllowOverride all" for the document root folder:

Code:
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
- Added the following entry:

Code:
<Directory /var/www/webapp>
Options FollowSymLinks
AllowOverride all
Order allow,deny
allow from all
</Directory>

[4] Created the file .htaccess in the webapp folder (/var/www/webapp/.htaccess) with the following content:

Code:
RewriteEngine On
RewriteRule ^(.*)$ http://hostname.dyndns.org:65123/webapp
[5] The ran <sudo /etc/init.d/apache2 force-reload> when I was done.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache: Forward request to another box? MasterC Linux - Networking 11 12-23-2014 09:37 PM
Apache port forward matt_heys Linux - Software 3 05-21-2009 10:12 AM
Apache Configuration to forward to Tomcat ciphyre Linux - Server 0 10-10-2008 12:14 AM
Apache 2: forward http to https? OneSeventeen Linux - Software 2 07-03-2006 07:10 AM
Mod_Proxy (Apache) won't forward requests bentman78 Linux - Software 1 04-20-2004 08:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration