Newbie config not catching virtual host


I’ve just set up a domain name and i can’t get nginx to parse to the
correct subfolder. I think this is related to fastcgi, caused by an
error between my chair and keyboard.

I have /var/www/nginx-default/ with a default page; and i have a
subfolder with a site, so /var/www/nginx-default/subfolder/

This is my config:


I’m sure there are things i could replace with variables, set up a
default catch all, etc, but i’d take one step at a time…
This is probaby a missing coma or something, any help would be

Nuno Magalhães

I’ve changed sites-enabled so that it has default, which is a symlink
to sites-available/default. I have the 40x.html page both in the / and
in /mysite directories, with the right permissions.
I’ve changed sites-available/default to this

Now i get 301 or redirect loop complaints, depending on the browser.
Also, if i use isntead of i get redirected
to anyway.

Are there any suggestions?

Nuno Magalhães

Ok i wasn’t even getting my error page, which tend to happen if you
only specify the 50x. I’ve fiddled some more and came back to where i
was before, i.e., gets me the root page, php is parsing (i have
includes), css isn’t used, images don’t show up, so i’m missing a root
somewhere… gives me a 404 (my own, since i’ve
configured 40x) gives me the index, php parsed,
no css or images.

The same happens if i use the ip adress instead and it’s not changing
to in the adress bar anymore.

Nuno Magalhães

My new sites-enabled/default looks like this:

The only place i’m referring the domain dir is here:
location / {
root /var/www/nginx-default/domaindir;
#root /domaindir;
index index.php index.html;
The rest of the file doesn’t use the domaindir. However, trying to go
to won’t take me to the show me the domain’s index
but rather the nginx root index. The error log reports this:
2009/02/27 14:57:14 [error] 11880#0: *6 open()
“/var/www/nginx-default/domaindir/imagefile.png” failed (2: No such
file or directory)

But that image file is in the nginx root, not in the domaindir.

Nuno Magalhães