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.
Add
Nginx sends the request to Apache as soon as it realizes that the requested URL ends on .php, so you should add the following line to your Apache configuration file:
You can find more information about DirectoryIndex and its scope on this URL:
http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex