Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've configured Apache to proxy all requests to except for the the alias /bazbar. The proxy portion of the configuration works and the proxy pass portion works except that it serves the index.php as a plain text file.

How can I get Apache to serve the php files properly? Here is my configuration.

<VirtualHost *:80>
  Alias /bazbar /var/www/bazbar

  ProxyPreserveHost On

  ProxyPass /bazbar !

  <Location /bazbar>
    SetHandler None

  <Location />
    Order allow,deny
    allow from all
    ProxyPass http://localhost:8080
    ProxyPassReverse http://localhost:8080

*note I have confired that php is configured properly because when I go to http://localhost/somescript.php the php renders properly

share|improve this question
up vote 1 down vote accepted

Look at the <Location /bazbar> section. SetHandler None disables all handlers for that Location. You need to remove that directive in order for it to work as you expect.

share|improve this answer

If you visit http://localhost:8080/ on that machine, do you get index.php served as a text file or does it run on the server? In the case of proxy, apache will simply take what it got, and feed it back to the client. My first look would be there.

share|improve this answer
localhost:8080 is a separate application. When I go to localhost/bazbar/index.php the php script is rendered properly. The problem is that serves index.php as plain text. Does that help clarify? – adam Mar 5 '10 at 18:09
I misunderstood. I follow you now. Then I think the <Location /bazbar> section is your problem, If you read this page: You'll notice that you're disabling all handlers for that Location. If you remove the SetHandler directive, I think you'll find that it works. – Richard June Mar 5 '10 at 19:14
That was it. I replaced SetHandler None with Order allow,deny and allow from all and that worked. Can you submit another answer with that suggestion so I can accept that answer? I want to make sure the answer I accept is clear for others who read this question. – adam Mar 5 '10 at 19:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.