0

I've configured Apache to proxy all requests to foo.bar.com 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>
  ServerName foo.bar.com
  Alias /bazbar /var/www/bazbar

  ProxyPreserveHost On

  ProxyPass /bazbar !

  <Location /bazbar>
    SetHandler None
  </Location>

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

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

2 Answers 2

1

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.

1

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.

3
  • localhost:8080 is a separate application. When I go to localhost/bazbar/index.php the php script is rendered properly. The problem is that foo.bar.com/bazbar/index.php serves index.php as plain text. Does that help clarify?
    – adam
    Mar 5, 2010 at 18:09
  • I misunderstood. I follow you now. Then I think the <Location /bazbar> section is your problem, If you read this page: httpd.apache.org/docs/1.3/mod/mod_mime.html#sethandler 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. Mar 5, 2010 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, 2010 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .