Include don't Loading have Variables Path

server {
    listen       80;
    server_name  localhost;

    charset utf-8;

    location / {
    set $web_root d:/website/wordpress;
        root   $web_root;
        index  index.html index.htm index.php;
    }

    error_page  404              /404.html;

     redirect server error pages to the static page /50x.html

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   $web_root;
    }

    location ~ \.php$ {
        root           $web_root;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME

$web_root$fastcgi_script_name;
include fastcgi_params;
}

 include    $web_root/.htaccess;

}

include $web_root/.htaccess; This is load Rewrite Rule for nginx
But Nginx don’t load why?

[emerg]: CreateFile() “D:\nginx/conf/$web_root.htaccess” failed (3: The
system cannot find the path specified) in D:\nginx/conf/nginx.conf:42

How should I do? How do NGINX make it support.
please thanks.

Hello!

On Wed, Dec 30, 2009 at 08:54:58AM +0100, Nginx fans wrote:

[…]

include $web_root/.htaccess; This is load Rewrite Rule for nginx
But Nginx don’t load why?

[emerg]: CreateFile() “D:\nginx/conf/$web_root.htaccess” failed (3: The
system cannot find the path specified) in D:\nginx/conf/nginx.conf:42

Variables in nginx are evaluated at run time for each request. On
the other hand, configuration is loaded and parsed during startup.
So you can’t use variables for things needed during configuration
parsing, e.g. “include”.

Moreover, you don’t need variables to set root. It doesn’t change
between requests. Using variables here is just waste of
resources, warming the world for no reason. You don’t need
variables, you need configuration macros which are expanded at
time of reading configuration.

nginx doesn’t support configuration macros, but they are
trivially added by any config generation tools (e.g. make + sed
will do the trick).

Maxim D.