Newbie config not catching virtual host


#1

Greetings,

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:

/etc/nginx/nginx.conf http://pastebin.com/m618b1c46
/etc/nginx/fastcgi_params http://pastebin.com/m4a40a295
/etc/nginx/sites-enabled/default http://pastebin.com/m111dd757

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
appreciated.

Nuno Magalhães
LU#484677


#2

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
http://pastebin.com/m2e7c6869

Now i get 301 or redirect loop complaints, depending on the browser.
Also, if i use http://1.2.3.4 isntead of domain.com i get redirected
to domain.com anyway.

Are there any suggestions?

Nuno Magalhães
LU#484677


#3

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.,

http://domain.com 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…

http://domain.com/domaindir gives me a 404 (my own, since i’ve
configured 40x)

http://domain.com/domaindir/index.php 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 domain.com in the adress bar anymore.

Nuno Magalhães
LU#484677


#4

My new sites-enabled/default looks like this:
http://pastebin.com/d36e0020f

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 http://domain.com/ 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
LU#484677