Welcome! Log In Create A New Profile

Advanced

Variable being unset when I add another location.

Posted by falltime 
Variable being unset when I add another location.
May 18, 2012 04:26AM
I'm running into some inexplicable behavior with this config. I set a subdomain variable to a matching group from my server_name regex, and use it later in some rewrites and try_files. However, when I added the location block for static files: location ~* /.*/.*\.(jpg|jpeg|gif|css|png|js|ico|xml)$ The subdomain gets set to an empty string. Can somebody explain to me what is causing this?

Config:
server
{
listen 8080;
server_name ~^(?:\w*\.)?(\w+)\.domain\.com$;
set $subdomain $1;
access_log /var/log/nginx/example.com.access.log;

error_log /var/log/nginx/example.com.error.log debug;

root /home/falltime/vhosts/falltime/public;
rewrite_log on;

index index.php;



try_files $uri $uri/ /index.php?route=$subdomain$uri;

location = /
{
rewrite ^ /index.php?route=$subdomain last;
}

location ~* /.*/.*\.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
expires 1w;
}

location ~ \.php$
{

fastcgi_pass 127.0.0.1:9000;
fastcgi_param QUERY_STRING $query_string;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param test $subdomain;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}

# deny access to apache .htaccess files
location ~ /\.ht
{
deny all;
}


}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 183
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready