Is it possible using multiple directive on different root location? (Without Symlinks)

Cliff Wells cliff at develix.com
Wed May 2 04:56:34 UTC 2012


On Tue, 2012-05-01 at 19:20 -0700, antituhan wrote:
> If using alias, what the root document directive? Becasue public_html is
> outside the /home/antituhan/static. I've tried using alias
> /home/antituhan/public_html but the nginx shows errors not found. Any
> solution ?

Pay attention to the slashes. /home/antituhan/static is not the same
as /home/antituhan/static/ for an alias.

If you could share your error log, it would be helpful.

The following works for me:

server {
    listen localhost:80;

    root /var/www/test;

    location / {
        index index.html;
    }

    location /cdn/ {
        alias /var/www/static_html/;
    }
}

index.html has <img src="/cdn/1.jpg" /> and it shows up fine.

Regards,
Cliff



More information about the nginx mailing list