LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-04-2011, 12:24 AM   #1
jiecenzhao
LQ Newbie
 
Registered: May 2011
Posts: 13

Rep: Reputation: 0
How to rewrite/redirect directory to port number in apache?


Hello,

I have a website example.com, serving pages on port 80. I want the url example.com/redmine to be rewritten to port 3000, where my redmine server is running, without actually changing the URL. So the user typing in example.com/redmine/test would serve up example.com:3000/test, without the user actually connecting through the port. I know this can work through CPanel, but I don't know exactly how it was implemented. I'm looked at how mod_proxy, mod_proxy_html, and mod_rewrite, but I'm still quite confused on how to get my situation working.

Last edited by jiecenzhao; 06-04-2011 at 12:25 AM.
 
Old 06-04-2011, 03:02 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

This is a typical reverse proxy scenario. Take a look at this example configuration, to see how it's done

Regards
 
1 members found this post helpful.
Old 06-04-2011, 11:52 AM   #3
jiecenzhao
LQ Newbie
 
Registered: May 2011
Posts: 13

Original Poster
Rep: Reputation: 0
Ok, using

ProxyPass /tracker http://127.0.0.1:3000
ProxyPassReverse /tracker http://127.0.0.1:3000

I got example.com/tracker to load the page, but none of the javascript, css, and links render correctly. Especially since many of the urls are dynamic, I want it to catch-all.
 
Old 06-04-2011, 01:05 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Try to add:
Code:
ProxyPreserveHost On
and see if it helps.
Otherwise you need to install mod_proxy_html (use your distro's package manager to do so), or do some tweaking in the backend application configuration.

Regards
 
Old 06-04-2011, 05:24 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi again,

Ditch the post above.
After a little googling, looks like you need to follow the steps here to make redmine work behind an apache reverse proxy

Regards
 
  


Reply



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
redirect to lowercase directory apache secretlydead Linux - Server 1 05-04-2011 06:06 PM
[SOLVED] Redirect Apache (mod_rewrite) from subdomain to https directory (vhost) accessthecloud Linux - Newbie 2 05-02-2011 07:07 AM
[SOLVED] Apache: IP- and port-based virtual server with Redirect catkin Linux - Server 2 04-11-2011 11:42 PM
Apache 1.3 mod_rewrite - how to rewrite url with port dlugasx Linux - Server 1 05-19-2009 10:34 AM
apache rewrite port based on URL.. can it? sir-lancealot Linux - Server 1 05-13-2009 02:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:26 PM.

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