Set location based on query arg

ulik nginx-forum at forum.nginx.org
Thu Nov 10 23:46:10 UTC 2016


Here is what I want to do, in nginx conf language:

server {
    listen 80;

    server_name www.example.com;

    # root when path query arg is present
    if ($arg_path) {
        root /var/www/example/$arg_path;
    }
    
    # root when path query arg is not present (default)
    if (!$arg_path) {
        root /var/www/example/default;
    }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,270868,270870#msg-270870



More information about the nginx mailing list