LinuxQuestions.org
Review your favorite Linux distribution.
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 12-17-2007, 05:16 PM   #1
mtlhd
Member
 
Registered: Sep 2007
Location: Ohio
Distribution: Debian, CentOS, Ubuntu
Posts: 126

Rep: Reputation: 18
need to proxy certain webpages to another port for php5 instance


Does anyone know how to configure apache to proxy a webpage I made to forward to another port so it will run the php5 instance that islistening to that port ???

<directory> ?????????
<VirtualHost> ????????

one of those?

thanks!

-mtlhd
your resident linux noob
 
Old 12-17-2007, 07:54 PM   #2
Shade
Senior Member
 
Registered: Mar 2003
Location: Burke, VA
Distribution: RHEL, Slackware, Ubuntu, Fedora
Posts: 1,418
Blog Entries: 1

Rep: Reputation: 46
There are a couple ways to do this.

First would be to simply use a rewrite rule to tack on the corrected port. Something like this in .htaccess or the <VirtualHost> section:

Code:
RewriteEngine On
# Redirect to alt port
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ http://your.domain.com:8080/$1 [R,L]
Replace 8080 with your alternate port, and your.domain.com with, obviously, your domain.

Another method is to use mod_proxy and set up a reverse proxy. This is what you want to do if you need to run both instances, php4 and php5, and don't want visitors to see the alternate port in the URL.

Something like this, once you've installed and enabled mod_proxy:
Code:
ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

# Then add the following to the <VirtualHost> section of the site...

ProxyPass /foo http://foo.example.com:8080/bar
ProxyPassReverse /foo http://foo.example.com:8080/bar
Here's an excellent howto, although probably more thorough than you need.
 
  


Reply

Tags
apache, php, proxy


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
PHP5.2.2 with Apache 2.2.4 - Can't ./configure - Also, how do I do port fowarding? Virtuality Linux - Server 7 05-30-2007 02:04 PM
Proxy server flodded by requests on port 53 & port 25 saurabh_sahni Linux - Security 5 04-26-2005 11:35 PM
Proxy server flodded by requests on port 53 & port 25 saurabh_sahni Linux - Networking 1 04-26-2005 04:01 PM
How to proxy any to any port / IP / service nicflatterie Linux - Networking 2 03-14-2005 07:56 AM
HTTP port and Proxy port problem AZIMBD03 Linux - Networking 3 04-15-2004 10:20 PM


All times are GMT -5. The time now is 05:50 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration