Nginx requesting index through reverse-proxy

apache-2.2nginxPROXY

I'm working on a test setup for nginx+apache. I have nginx listening on port 80, apache on port 8080. Nginx is set up to deal out the static content, apache is there to deal out the dynamic content (at least until we can upgrade to php 5.3). My apache setup works fine, here's the server section for nginx:

server {

    listen           80;
    server_name  mediocregopher-test;
    index test.php;

    location ~ \.php$ {
        proxy_pass   http://127.0.0.1:8080;
    }

    location ~ /\.ht {
        deny  all;
    }

    location / {
        root   /var/www/html;
    }
}

The issue is, my index page (test.php) needs to be proxy'd to apache as "127.0.0.1:8080/test.php" when someone requests "mediocregopher-test:80/". With this setup this isn't happening. I'm fairly new to nginx, but I've looked around and couldn't find any setups that would solve this (although the problem is so simple it seems like it would be). Any suggestions?

I'm using nginx 1.0.1, if that's at all relevant.

Best Answer

Add

location = / {
  proxy_pass http://127.0.0.1:8080/test.php;
}
Related Topic