Home  >  Q&A  >  body text

nginx multi-directory configuration issues

location = /static {
    root "C:\Users\****\Desktop\cx\www";
}
location = /admin {
    alias "C:\Users\****\Desktop\cx-admin\app";
}
location /{...}

app is a static file directory
I hope that when accessing /admin, it will be equivalent to accessing the app directory
And when accessing admin/, access app/index.html without rewriting
How should I modify it?

PHPzPHPz2714 days ago424

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 17:12:10

    location /static {
            alias C:\Users\****\Desktop\cx\www\static/;
            etag         on;
            expires      max;
            access_log off;
        }
        location /admin {
            alias C:\Users\****\Desktop\cx-admin\dist/;
            etag         on;
            expires      max;
        }
        location / {
        ...

    reply
    0
  • Cancelreply