Possible bug in "root" declaration?
Systems Maintenance
systems at goballistic.co.uk
Thu May 28 18:42:19 MSD 2009
Igor Sysoev wrote:
> On Thu, May 28, 2009 at 02:51:11PM +0100, Systems Maintenance wrote:
>
>> Below is part of a server block for a particular vhost:
>>
>> server {
>> server_name mysite.tld ~^.+\.mysite\.tld$;
>>
>> set $base /var/www/mysite;
>>
>> if ( $host ~* "^(x|y|z)\.mysite\.tld$" ){
>> set $files misc;
>> }
>>
>> if ( $host ~* "^(admin)\.mysite\.tld$" ){
>> set $files admin;
>> }
>>
>> if ( $host = "mysite.tld" ){
>> set $files home;
>> }
>>
>
> This is not effective way. It's better to use map:
>
> map $host $files {
> default home;
> mysite.tld home;
> admin.mysite.tld admin;
> x.mysite.tld misc;
> y.mysite.tld misc;
> z.mysite.tld misc;
> }
>
We're also capturing "wildcard" subdomains in the vhost with:
if ( $host ~* "^([a-zA-Z]+[a-zA-Z0-9]*)\.mysite\.tld$" ){
set $files custom;
}
so if someone hits "a8df15f.mysite.tld" they get a custom homepage, but
"18sdf351f.mysite.tld" is invalid and therefore they get the "home
page". Can this also be reproduced with the "map" directive?
>> root $base/$files/www;
>> error_page 404 $base/errors/404.html;
>>
>> location / {
>> try_files $uri @webapp;
>> }
>>
>> location @webapp {
>> rewrite ^/([\w\d]+)/([\w\d]+)(.*)? /index.php/$1/$2?_params=$3 last;
>> }
>>
>> location ~ \.php($|/) {
>> set $script $uri;
>> set $path_info "";
>>
>> if ($uri ~ "^(.+\.php)(/.+)") {
>> set $script $1;
>> set $path_info $2;
>> }
>>
>> fastcgi_pass unix:/tmp/php-socket;
>> include conf/fastcgi_params;
>> fastcgi_intercept_errors on;
>> fastcgi_param SCRIPT_FILENAME $base/$interface$script;
>> fastcgi_param PATH_INFO $path_info;
>> fastcgi_index index.php;
>> }
>>
>> }
>>
>> What I'm seeing in my error log is that the error_page its trying to
>> return is: /var/www/mysite/var/www/mysite/errors/404.html instead of the
>> expected /var/www/mysite/errors/404.html
>>
>
> error_page uses URI, but not file:
>
> error_page 404 /errors/404.html;
>
> location = /error/404.html {
> set /var/www/mysite;
> }
>
Thanks, I'll try this.
>> --without-mail_pop3_module
>> --without-mail_imap_module --without-mail_smtp_module
> mail modules are not built by default.
>
This isn't mentioned in "./configure --help":
--with-mail enable POP3/IMAP4/SMTP proxy module
--with-mail_ssl_module enable ngx_mail_ssl_module
--without-mail_pop3_module disable ngx_mail_pop3_module
--without-mail_imap_module disable ngx_mail_imap_module
--without-mail_smtp_module disable ngx_mail_smtp_module
More information about the nginx
mailing list