views:

481

answers:

1

I'm setting up nginx with multiple domain or wildcard support for convenience sake, rather than setting up 50+ different sites-available/* files. Hopefully this is enough to show you what I'm trying to do. Some are static sites, some are dynamic with usually wordpress installed.

If an index.php exists, everything works as expected.

If a file is requested that does not exist (missing.html), a 500 error is given due to the rewrite. The logged error is:

*112 rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/missing.html"

The basic nginx configuration I'm currently using is:

`

listen 80 default;
server _;

...

location / {
    root /var/www/$host;

    if (-f $request_filename) {
            expires max;
            break;
    }

    # problem, what if index.php does not exist?

    if (!-e $request_filename) {
            rewrite ^/(.*)$  /index.php/$1 last;
    }
}

...

`

If an index.php does not exist, and the file also does not exist, I would like it to error 404. Currently, nginx does not support multiple condition if's or nested if so I need a workaround.

A: 
if ($_SERVER['HTTP_HOST'] == 'desideshat.com')
 {
 $vboptions['bburl'] = 'http://www.desideshat.com';
 }
 else
 {
 $vboptions['bburl'] = 'http://www.vedesi.com';
 } 
?>
VeDesi.CoM