NGINX try_files + alias directives

后端 未结 3 1304
后悔当初
后悔当初 2020-12-23 09:42

I\'m trying to serve request to /blog subdirectory of a site with the php code, located in a folder outside document root directory. Here\'s my host config:

         


        
3条回答
  •  长情又很酷
    2020-12-23 10:04

    This is a long standing bug in nginx. But you can work around by using the root directive again. Kind of a hack, but at least it works.

    server {
        index       index.php;
        root        /home/alex/www/test2;
        server_name local.test.ru;
    
        location /blog {
            root      /home/alex/www/test1;
            try_files $uri $uri/ /blog$is_args$args;
        }
    }
    

提交回复
热议问题