LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 05-27-2010, 10:55 PM   #1
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Rep: Reputation: 0
How can I enable the rewrite module for my apache 2.0.53 in redhat linux server?


Hi, I posted a question here yesterday is mentioned about redirect a domain name with /abc to external ip of web server.
Now I can made sure that I should use the rewrite module to achieve this issues. But I don't know how can I enable this function in my apache web server. I will post my httpd.conf for your reference.
Please help, thank you so much.
 
Old 05-27-2010, 11:00 PM   #2
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Any body know how to do it?

Last edited by elok; 05-30-2010 at 09:37 PM.
 
Old 05-27-2010, 11:01 PM   #3
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Why there is nobody answer me?

Last edited by elok; 05-30-2010 at 09:39 PM.
 
Old 05-27-2010, 11:05 PM   #4
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
I want to redirect only the domain name with m.domain.com/abc to external ip 123.123.123.123/abc.
I really need your help. Thank you.
 
Old 05-30-2010, 09:39 PM   #5
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Hello, anybody can help me?
 
Old 05-31-2010, 02:03 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

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

You should not bump your thread every 5min. When someone knows the answer to your question he will answer.

Anyway you can use either Redirect or mod_rewrite. In your case Redirect is the simplest way to go:
Code:
Redirect /abc http://123.123.123.123/abc
Regards
 
Old 05-31-2010, 02:16 AM   #7
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Thanks, bathory.
I want to know where should I put this statment

Code:
Redirect /abc http://123.123.123.123/abc

Because I need to redirect the domain m.domain.com/abc to external ip address http://123.123.123.123/abc, I already setup the Virtual Host of m.domain.com in httpd.conf. Should I put this statement in side <VhostXXX> of m.domain.com or inside the <Directory> of <Vhost> of m.greenpeace.com?

Thanks so much.
 
Old 05-31-2010, 02:23 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You should put it inside the vhost m.domain.com definition.
If you think this is going to be permanent you can use:
Code:
Redirect permanent /abc http://123.123.123.123/abc

Last edited by bathory; 05-31-2010 at 02:52 AM.
 
Old 05-31-2010, 02:37 AM   #9
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
bathory, thanks your quickly reply. I still have one question, If I just want the end user display the http://m.domain.com/abc in there browser address bar instead of to show http://123.123.123.123/abc. How can I do for it?
 
Old 05-31-2010, 02:52 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can use any of the following:

One way to do this, is to use frames in /abc/index.html. The main frameset and a zero-length frame should reside on your server and the main frame should point to http://123.123.123.123/abc. This way the address bar will show your server url.

Another way to do this is to use the vhost m.domain.com as a reverse proxy for /abc to http://123.123.123.123/abc. You'll need mod_proxy for this

Regards
 
Old 05-31-2010, 03:10 AM   #11
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Great, Thansk so much. I can redirect it now. But I want to know how can I use mod_proxy for a reverse proxy for /abc for http://123.123.123.123/abc for my vhost m.domain.com?
 
Old 05-31-2010, 03:18 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Basically you'll need to load the relevant apache proxy modules and use something like:
Code:
ProxyPass /abc http://123.123.123.123/abc
ProxyPassReverse /abc http://123.123.123.123/abc
Take a look here for more details.

Regards
 
Old 06-02-2010, 04:38 AM   #13
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
hi bathory, I tried to use the code as you gave me:
ProxyPass /abc httpd://123.123.123.123/abc
ProxyPassReverse /abc http://123.123.123.123/abc
in my Vhost section and restart the httpd, then I received the below error:
Invalid command 'ProxyPass', perhaps mis-spelled or defined by a module not included in the server configuration

Then I tired to load the module by add LoadModule for mod_proxy.so and mod_proxy_http.so to my httpd.conf then restart it and receive the below error:
Cannot load /usr/local/apache-2.0.54_SSL_WEBDAV_REWRITE/modules/mod_proxy.http.so into server: /usr/local/apache-2.0.54_SSL_WEBDAV_REWRITE/modules/mod_proxy.http.so: cannot open shared object file: No such file or directory

So what can I do to enable the ProxyPass can work for my web server?
Thank you so much for your help.
 
Old 06-02-2010, 05:11 AM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
It looks like you don't have mod_proxy installed. To verify if that's the case run:
Code:
 /usr/local/apache-2.0.54_SSL_WEBDAV_REWRITE/bin/apachectl -M|grep proxy
You should tell us your distro and how did you install apache, so we could suggest a way to add the missing modules.
BTW from the log you've posted it looks like you have compiled apache from source (because it's installed under /usr/loca/apache-2.0.54_SSL_WEBDAV_REWRITE).
 
Old 06-02-2010, 09:17 PM   #15
elok
LQ Newbie
 
Registered: May 2010
Posts: 23

Original Poster
Rep: Reputation: 0
Hi bathory, when I ran the code from the above you gave me then I got the error:
In fact, this apache is not installed by me. So I don't know how it is installed, but I think it is installed by compile the source as you said. Because the path of the httpd is not the default path.
I am using the apache v 2.0.53 and running it in Fedora release 3.
What can I do now to check it is the proxy installed properly in my web sever?
Thank you for your help.

apachectl -M|grep proxy
httpd: illegal option -- M
Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S : a synonym for -t -D DUMP_VHOSTS
-t : run syntax check for config files

Last edited by elok; 06-02-2010 at 10:09 PM.
 
  


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
Linux Apache Rewrite Rule jon_k Linux - Software 1 06-10-2009 02:09 AM
Server OS/Redhat/Linux/Apache ???? smee00 Linux - Newbie 3 05-19-2007 08:25 AM
apache proxy server rewrite urls slackwarefan Linux - Software 0 10-19-2004 07:58 PM
Use apache to rewrite to external server and keep same browser URL ijsman77 Linux - Software 1 04-09-2004 07:32 AM

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

All times are GMT -5. The time now is 04:26 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