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


  Search this Thread
Old 12-17-2007, 04:16 PM   #1
Registered: Sep 2007
Location: Ohio
Distribution: Raspbian, 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?


your resident linux noob
Old 12-17-2007, 06:54 PM   #2
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:

RewriteEngine On
# Redirect to alt port
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$$1 [R,L]
Replace 8080 with your alternate port, and 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:
ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all

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

ProxyPass /foo
ProxyPassReverse /foo
Here's an excellent howto, although probably more thorough than you need.


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 01:04 PM
Proxy server flodded by requests on port 53 & port 25 saurabh_sahni Linux - Security 5 04-26-2005 10:35 PM
Proxy server flodded by requests on port 53 & port 25 saurabh_sahni Linux - Networking 1 04-26-2005 03:01 PM
How to proxy any to any port / IP / service nicflatterie Linux - Networking 2 03-14-2005 06:56 AM
HTTP port and Proxy port problem AZIMBD03 Linux - Networking 3 04-15-2004 09:20 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:16 PM.

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