Forum: NGINX Newbie config not catching virtual host.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Nuno Magalhães (Guest)
on 2009-02-27 03:37
(Received via mailing list)

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/

- What i want:
If a user enters:
s/he should get: /var/www/nginx-default/subfolder/
which would become: /var/www/nginx-default/subfolder/index.php
(preferably without showing the filename in the adress bar)

- What i have:
If i enter i get the default page at
wwwroot, no css or images;
if i enter i get the 404 error page;
if i enter i get the
page i want, php-parsed, no css or images.
This is the same if i use the IP adress instead (only much faster),
although browser-caching had me confused for a while...

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
Nuno Magalhães (Guest)
on 2009-02-27 15:44
(Received via mailing list)
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
Nuno Magalhães (Guest)
on 2009-02-27 16:48
(Received via mailing list)
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
Nuno Magalhães (Guest)
on 2009-02-27 17:10
(Received via mailing list)
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
This topic is locked and can not be replied to.